Skip to content

Instantly share code, notes, and snippets.

View trekdemo's full-sized avatar

Gergő Sulymosi trekdemo

View GitHub Profile
@trekdemo
trekdemo / gist:5048069
Created February 27, 2013 13:57
Jobsworth migrations sorted by git authored date
for file in db/migrate/*; do
echo "$(date -r $(git log --format=%at $file | tail -n1) +%Y%m%d%H%M%S) $file";
done;
20070401155320 db/migrate/004_add_timezone.rb
20070401155320 db/migrate/005_user_interface_type.rb
20070401155320 db/migrate/006_user_external_clients.rb
20070401155320 db/migrate/007_user_show_calendar.rb
20070401155320 db/migrate/008_client_css.rb
20070401155320 db/migrate/009_add_tasks_company_id.rb
Before do |scenario|
DeferredGarbageCollection.start
end
After do |scenario|
DeferredGarbageCollection.reconsider
end
at_exit do
DeferredGarbageCollection.stop
/*
*
* Mongo-Hacker
* MongoDB Shell Enhancements for Hackers
*
* Tyler J. Brock - 2013
*
* http://tylerbrock.github.com/mongo-hacker
*
*/
@trekdemo
trekdemo / git_time_since_commit.fish
Created May 11, 2014 19:48
Fish Shell Snippet to add time since last commit
function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _git_initialized_repo
test (git rev-parse --git-dir ^/dev/null | wc -l) -gt 0
end
function _git_commit_exists
test (git log ^&1 | grep --count "^fatal") -eq 0
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo apt-get install postgresql-9.3-postgis pgadmin3 postgresql-contrib -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
@trekdemo
trekdemo / case_eg.rb
Created April 7, 2015 14:46
How to mimic fall through with ruby
# Usage:
# foo('Near the intersection of Lexington Ave and E 40th St')
# # => ['Lexington Ave', 'E 40th St']
# foo('Between Lexington Ave and E 40th St')
# # => ['Lexington Ave', 'E 40th St']
#
def foo(value)
case value
when (re = /^Near the intersection of (.*) and (.*)$/)
when (re = /^Between (.*) and (.*)$/)
#!/usr/bin/env ruby
# This script creates LaunchBar snippets for kaomojis
#
# About kaomojis: http://www.gomotes.com/text-emoticons/
# About LaunchBar snippets: https://blog.obdev.at/introducing-launchbar-snippets/
#
# Run without `git checkout`
#
# ruby -e "$(curl -fsSL <RAW URL OF THIS GIST>)"
#
@trekdemo
trekdemo / clojure-dojo.md
Last active November 29, 2015 13:19 — forked from skuro/clojure-dojo.md
Crime at Piccadilly Circus

Results of the Clojure Dojo

This gist is just a placeholder for your solution of the Clojure Dojo from the Amsterdam Clojurians meetup.

To share your solution:

  • fork this gist
  • add the files containing your code to the forked gist

Thanks!

function cronitor {
if [ $# -ne 2 ]; then return; fi
if [ -z "$1" ]; then return; fi
if [ -z "$2" ]; then return; fi
echo "Sending signal to - https://cronitor.link/${2}/${1}"
curl "https://cronitor.link/${2}/${1}" -m 10
}
# Usage