Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Lysenka alkos333

View GitHub Profile
@alkos333
alkos333 / xcode-cli-tools.sh
Last active Feb 20, 2019 — forked from rtrouton/gist:f92f263414aaeb946e54
Install Xcode command line tools on 10.7.x - 10.10.x. Tested on 10.7.5, 10.8.5, 10.9.5 and 10.10.2.
View xcode-cli-tools.sh
#!/bin/bash
# Installing the Xcode command line tools on 10.7.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Installing the latest Xcode command line tools on 10.9.x or higher
if [[ "$osx_vers" -ge 9 ]]; then
@alkos333
alkos333 / gist:1771618
Created Feb 8, 2012
Read URL GET variable
View gist:1771618
// Given a query string "?to=email&why=because&first=John&Last=smith"
// getUrlVar("to") will return "email"
// getUrlVar("last") will return "smith"
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/
function getUrlVar(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
}
@alkos333
alkos333 / hanoi.js
Created Jan 30, 2012
Towers of Hanoi (Recursive)
View hanoi.js
#!/usr/bin/env node
var hanoi = function(disc, src, tmp, dst){
if(disc > 0){
hanoi(disc - 1, src, dst, tmp);
console.log(disc + " " + src + "->" + dst);
hanoi(disc - 1, tmp, src, dst);
}
}
View Recursively add .gitignore files to empty dirs
# Recursively add a .gitignore file to all directories
# in the working directory which are empty and don't
# start with a dot. Helpful for tracking empty dirs
# in a git repository.
find . -type d -regex ``./[^.].*'' -empty -exec touch {}"/.gitignore" \;
@alkos333
alkos333 / gist:1503497
Created Dec 20, 2011
Sass parse error when assigning a varable
View gist:1503497
/usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/repl.rb:38:in `parse_input': undefined method `size' for nil:NilClass (NoMethodError)
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/repl.rb:27:in `block in run'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/repl.rb:19:in `loop'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/repl.rb:19:in `run'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/exec.rb:353:in `interactive'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/exec.rb:301:in `process_result'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/exec.rb:41:in `parse'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/lib/sass/exec.rb:21:in `parse!'
from /usr/lib64/ruby/gems/1.9.1/gems/sass-3.1.12/bin/sass:8:in `<top (required)>'
from /usr/bin/sass:19:in `load'