d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Make Me A Better Programmer - From Step 2
Prev123410Next
Add Reply New Topic New Poll
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Oct 29 2014 10:50pm
Quote (carteblanche @ Oct 29 2014 11:45pm)
http://www.youtube.com/watch?v=GNyUlQGQx54


I need an adult?
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 30 2014 12:36am
Quote (carteblanche @ Oct 29 2014 11:11pm)
Shit. forgot to start this topic with:

Dear Diary,


http://www.uguu.org/sources.html?a=b

this is for you
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 26 2014 05:06pm
discovered Less, a css preprocessor. it allows "variables" (not sure if they can really change; i suspect they're just preprocessor macros like in C) and "mixins" for anyone interested.

http://en.wikipedia.org/wiki/Less_stylesheet_language

copying from wiki:

variables, before:
Code
@color: #4D926F;

#header {
color: @color;
}
h2 {
color: @color;
}

after:
Code
#header {
color: #4D926F;
}
h2 {
color: #4D926F;
}


mixins, before:
Code
.rounded-corners (@radius: 5px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}

#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px);
}


after:
Code
#header {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#footer {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}


briefly read about SASS, but i got a negative impression since it's not backwards compatible with CSS since they changed to a different syntax. it's "related" to Haml, which i personally don't care for.

This post was edited by carteblanche on Nov 26 2014 05:10pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 26 2014 05:08pm
we were on a call with a company that does front end stuff, and they were enthusiastic about fb's React and my boss is considering having us look into that. boss already dismissed angular, and he has a hard time find Dart developers.
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Nov 26 2014 05:16pm
Quote (carteblanche @ Nov 26 2014 06:08pm)
we were on a call with a company that does front end stuff, and they were enthusiastic about fb's React and my boss is considering having us look into that. boss already dismissed angular, and he has a hard time find Dart developers.


Why did he dismiss angular?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 26 2014 05:33pm
Quote (Minkomonster @ Nov 26 2014 06:16pm)
Why did he dismiss angular?


he didnt dismiss it for being bad. 2 of the team didn't care for it a year ago when they looked into it. the company we talked to said its two-way binding can be very slow when there's a lot of data. i'm not sure how true that is tbh. boss didnt have a compelling reason to force it on us if we're not enthusiastic about it, so he's fine with looking into other frameworks instead. boss is just looking at trends to see what's popular and letting us pick from there.

/edit: from my brief look at angular and react, i'd rather work with angular since it's just tags directly on the html elements, versus react where it's created via javascript. but that's a pretty shallow and naive reason, lol

This post was edited by carteblanche on Nov 26 2014 05:38pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 26 2014 11:42pm
Only posting this for my reference: http://stackoverflow.com/questions/12114465/i-set-font-size-to-16pt-but-when-i-fetch-it-it-returns-21px-can-i-get-it-to-re

used that to fix nekosama's font. never used jquery before, so i thought i'd give it a go. thought it was really weird that i saw "font-size:30pt" in the html, but .css("font-size") gave back "40px", so i googled it like a pro.

Code
// ==UserScript==
// @name Fix NekoSama's posts
// @namespace http://your.homepage/
// @version 0.1
// @description Changes NekoSama's font to normal black instead of giant green
// @author carteblanche
// @match http://forums.d2jsp.org/topic.php*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

$(document).ready(function() {
var greenFont = $('span').filter(function(){
return $(this)[0].style.color == 'green';
});
if (greenFont.length > 0){
greenFont.css('color', 'rgb(0,0,0)');
}

var largeFont = $('span').filter(function(){
return $(this)[0].style.fontSize == '30pt';
});
if (largeFont.length > 0){
largeFont.css('font-size', '8pt');
}

});


considering making it search for nekosama's posts as opposed to just changing all spans everywhere on the page, and making it more generic. but doubt i'll get around to it.

/edit: tampermonkey script

/edit2: lets see. to fix all of nekosama's posts, i can find the <dt> that contains:
<a> with attribute href="user.php?i=434436" and text NekoSama
then crawl up to the <dl>, then fix all the <span> inside it

/edit3: @Eep, wanna update it for me?

This post was edited by carteblanche on Nov 27 2014 12:04am
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 27 2014 12:35am
Quote
2 User(s) are reading this topic (0 Guests and 1 Anonymous): Minkomonster


you better not be fixing it...that's for Eep!
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Nov 27 2014 01:44am
Quote (carteblanche @ Nov 27 2014 12:42am)
Only posting this for my reference: http://stackoverflow.com/questions/12114465/i-set-font-size-to-16pt-but-when-i-fetch-it-it-returns-21px-can-i-get-it-to-re

used that to fix nekosama's font. never used jquery before, so i thought i'd give it a go. thought it was really weird that i saw "font-size:30pt" in the html, but .css("font-size") gave back "40px", so i googled it like a pro.

Code
// ==UserScript==
// @name        Fix NekoSama's posts
// @namespace    http://your.homepage/
// @version      0.1
// @description  Changes NekoSama's font to normal black instead of giant green
// @author      carteblanche
// @match        http://forums.d2jsp.org/topic.php*
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

$(document).ready(function() {
    var greenFont = $('span').filter(function(){
        return $(this)[0].style.color == 'green';
    });
    if (greenFont.length > 0){
    greenFont.css('color', 'rgb(0,0,0)');
    }
   
    var largeFont = $('span').filter(function(){
        return $(this)[0].style.fontSize == '30pt';
    });
    if (largeFont.length > 0){
    largeFont.css('font-size', '8pt');
    }

});


considering making it search for nekosama's posts as opposed to just changing all spans everywhere on the page, and making it more generic. but doubt i'll get around to it.

/edit: tampermonkey script

/edit2: lets see. to fix all of nekosama's posts, i can find the <dt> that contains:
<a> with attribute href="user.php?i=434436" and text NekoSama
then crawl up to the <dl>, then fix all the <span> inside it

/edit3: @Eep, wanna update it for me?


uhhh, this might be hard to believe but I haven't actually used jquery before (always done vanilla js without frameworks etc for doing projects)

Also, I am kinda busy the next few days ~_~

but it seems you already had a blueprint for doing it.

guessing something like
Code
var html = $('html')
might be useful

then just parse it, find da shit you want, change it?

This post was edited by Eep on Nov 27 2014 01:52am
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 27 2014 01:52am
Quote (Eep @ Nov 27 2014 02:44am)
uhhh, this might be hard to believe but I haven't actually used jquery before (always done vanilla js without frameworks etc for doing projects)

Also, I am kinda busy the next few days ~_~

but it seems you already had a blueprint for doing it.


that's the point :P
Go Back To Programming & Development Topic List
Prev123410Next
Add Reply New Topic New Poll