Skip to content

Instantly share code, notes, and snippets.

View anagorsky's full-sized avatar
🕶️

Vitaly Anagorsky anagorsky

🕶️
View GitHub Profile
http://una.im/CSSgram/
@anagorsky
anagorsky / zsh.md
Last active August 18, 2018 21:24 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@anagorsky
anagorsky / gist:26fedc7584dd88b08c13
Created October 7, 2015 22:24 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@anagorsky
anagorsky / pack_unpuck_bytes.js
Last active September 15, 2015 21:03
Pack and unpack bytes to strings
function pack(bytes) {
var str = "";
for(var i = 0; i < bytes.length; i += 2) {
var char = bytes[i] << 8;
if (bytes[i + 1])
char |= bytes[i + 1];
str += String.fromCharCode(char);
}
return str;
}
@anagorsky
anagorsky / qsort.js
Last active September 15, 2015 21:03
/*
* Алгоритм быстрой сортировки
*
* @param data Array
* @param compare function(a, b) - возвращает 0 если a=b, -1 если a<b и 1 если a>b (необязательная)
* @param change function(a, i, j) - меняет местами i-й и j-й элементы массива а (необязательная)
*
*/
function qsort(data, compare, change) {
var a = data,
@anagorsky
anagorsky / multi.js
Last active September 15, 2015 21:04
var multi = function(a){
var tmp = function(b){
a*=b;
tmp.valueOf = function(){return a};
return tmp;
}
return tmp;
};
console.log(multi(2)(2)(2));
/*
* From css-tricks.com
* http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
@anagorsky
anagorsky / .profile
Created November 18, 2013 13:07 — forked from kenzie/.profile
# add these aliases to your BASH profile ~/.profile
alias mongodb-start="mongod run --config /usr/local/etc/mongod.conf"
alias redis-start="redis-server /usr/local/etc/redis.conf"
# TODO add stop commands