This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** see bug flickering http://stackoverflow.com/questions/2946748/iphone-webkit-css-animations-cause-flicker */ | |
.antiflicker{ | |
-webkit-perspective: 1000; | |
-webkit-backface-visibility: hidden; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The book Speed Up Your Site (New Riders) introduced a version of Duff’s Device in JavaScript that moves the processing of the extra array items outside the main loop, allowing the switch statement to be removed and resulting in an even faster way of processing a large number of items: | |
var iterations = Math.floor(values.length / 8); | |
var leftover = values.length % 8; | |
var i = 0; | |
if (leftover > 0){ | |
do { | |
process(values[i++]); | |
} while (--leftover > 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//a collection of git aliases | |
//to have them on all projects on my user | |
//vim ~/.gitconfig | |
[alias] | |
cp = cherry-pick | |
st = status -s | |
ci = commit | |
br = branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Center the browser vertically on the game board */ | |
var centerBrowserGameBoard = function() | |
{ | |
var w_height = $j(window).height(); | |
var table_top = $j('#div').offset().top; | |
var table_height = $j('#div').height(); | |
//if no need to scroll - the table is visible | |
if (!force && w_height > (table_top + table_height)) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// snippet for blog post | |
// http://btools.eu/read/2013/how-to-store-multiple-images-or-documents-on-server/ | |
<?php | |
//we presume we have an unique ID for every picture | |
for ($id_pic = 1; $id_pic < 10000; $id_pic += 100) | |
{ | |
# echo PHP_EOL.getPadImgFolder($id_pic).'/'.$id_pic.'.jpg'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias l='ls -Ahq --group-directories-first --color' | |
alias resm='sudo /etc/init.d/memcached restart' | |
alias resn='sudo /etc/init.d/nginx restart' | |
alias resp='sudo /etc/init.d/php5-fpm restart' | |
alias resmy='sudo /etc/init.d/mysqld restart' | |
alias aptg='sudo apt-get' | |
alias ports='netstat -tulanp' | |
alias psmem='ps auxf | sort -nr -k 4 | head -10' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//thanks http://nixgeeks.com/how-to-enable-automatic-login-in-ubuntu-server/ | |
sudo nano /etc/init/tty1.conf | |
//last line | |
exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cssAnimationEndHandlerNS = 'animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd'; | |
selector.addClass('animation'); | |
.bind(cssAnimationEndHandlerNS, function () | |
{ | |
Sselector | |
.removeClass('animation') | |
.unbind(cssAnimationEndHandlerNS); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ntpdate pool.ntp.org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var month= ["January","February","March","April","May","June","July", | |
"August","September","October","November","December"]; | |
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul","Aug", "Sep", "Oct", "Nov", "Dec"]; | |
//used with date.getMonth() |