This file contains 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
function getParameterByName(name, url) { | |
if (!url) url = window.location.href; | |
name = name.replace(/[\[\]]/g, "\\$&"); | |
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
} |
This file contains 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
source ~/.rvm/scripts/rvm |
This file contains 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
android create project -a Main -k com.example.app -t 19 -g -v 0.10 \ | |
-p AppWithGradleTemplate |
This file contains 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
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 |
This file contains 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
ARGV.each do |arg| | |
file = File.open(arg, 'r') | |
all_words = file.read.split(/\W+/) | |
all_words_with_count = all_words.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h } | |
all_words_with_count.sort_by { |_key, value| value }.to_h.each do |word, count| | |
puts "#{word},#{count}" | |
end | |
end |
This file contains 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
ARGV.each do |arg| | |
file = File.open(arg, 'r') | |
content = file.read.split(/\W+/).uniq # content is Array | |
end |
This file contains 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
Dir["./*.sql"].each { |f| system "sqlcmd -S SERVER\INSTANCE -U sa -P PASS -d DBNAME -i #{f}"} |
This file contains 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
PAGE_SIZE = 10000 | |
line_strat = 0 | |
line_end = PAGE_SIZE | |
file_content = "" | |
page_number = 1 | |
File.open("data", "r:utf-8").each_line.with_index do |line, index| | |
if index < line_end && index >= line_strat | |
File.open "part#{page_number}.sql", "a:utf-8" do |f| | |
f.write line | |
end |
This file contains 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
To delete a local branch | |
git branch -d the_local_branch | |
To remove a remote branch (if you know what you are doing!) | |
git push origin :the_remote_branch |
This file contains 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
#!/bin/bash | |
# this script is not written by me. Just using it and sharing it here. | |
# export DBUS_SESSION_BUS_ADDRESS environment variable useful when the script is set as a cron job | |
PID=$(pgrep gnome-session) | |
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) | |
# $bing is needed to form the fully qualified URL for |