Skip to content

Instantly share code, notes, and snippets.

View manuelvanrijn's full-sized avatar

Manuel van Rijn manuelvanrijn

View GitHub Profile
@manuelvanrijn
manuelvanrijn / guid.js
Created August 11, 2014 07:30
Javascript clientside GUID
/**
* @function _guid
* @description Creates GUID for user based on several different browser variables
* It will never be RFC4122 compliant but it is robust
* @returns {Number}
* @private
*/
var guid = function() {
var nav = window.navigator;
@manuelvanrijn
manuelvanrijn / osx-reset-context-menu.sh
Created April 16, 2014 22:22
reset osx context menu's
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"
@manuelvanrijn
manuelvanrijn / Autohotkey-Media
Created July 25, 2013 10:04
Small script for AutoHotKey when you don't have Media buttons on your keyboard. This script binds the keys below to the following Media actions: - PrintScreen = Previous - ScrollLock = Play/Pause - Break = Next
;
; Music player tweak
;
PrintScreen::
Send {Media_Prev}
Return
Break::
Send {Media_Next}
Return
@manuelvanrijn
manuelvanrijn / chrome-sass-source-maps.md
Created April 4, 2013 06:29
Enable SASS support for your Rails project within chrome using source maps
  1. Goto chrome://flags and enable Enable Developer Tools experiments
  2. Open de Developer toolbar and goto the General tab within settings. Check the Enable source maps
  3. Restart chrome
  4. Open de Developer toolbar and goto the Expirements tab. Check "Support for Sass"

Add the following to your config/environments/development.rb

config.assets.debug = true
config.sass.debug_info = true
@manuelvanrijn
manuelvanrijn / npm-publish.md
Created October 2, 2012 13:28
Howto publish your module to npm

Howto publish your module to npm

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser
// or npm login
@manuelvanrijn
manuelvanrijn / total_rows.sql
Created July 30, 2012 08:12
SELECT total_rows FROM postgres_database
SELECT
SUM(pgClass.reltuples) AS totalRowCount
FROM
pg_class pgClass
LEFT JOIN
pg_namespace pgNamespace ON (pgNamespace.oid = pgClass.relnamespace)
WHERE
pgNamespace.nspname NOT IN ('pg_catalog', 'information_schema') AND
pgClass.relkind='r'
@manuelvanrijn
manuelvanrijn / database.rake
Created January 19, 2012 14:54
Retrieve and convert PostgreSQL database to SQLite database (with ssh)
require 'fileutils'
namespace :db do
desc 'pull the production PostgreSQL database into the development SQLite'
task :pull do
Rake::Task['db:download_pg_dump'].invoke
Rake::Task['db:optimze_pg_dump_for_sqlite'].invoke
Rake::Task['db:recreate_with_dump'].invoke
end
@manuelvanrijn
manuelvanrijn / git-large-files.pl
Created November 10, 2011 09:36
large files in git repositories history
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
# usage:
# git-large-files 500k
# git-large-files 0.5m
# git-large-files 5b
@manuelvanrijn
manuelvanrijn / readable_number.js
Created October 12, 2011 14:31
number to human readable text
function readable_number(num){
var bits_a = ["thousand", "million", "billion", "trillion", "zillion"];
var bits_b = ["ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"];
var bits_c = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
if (num==0){return 'zero';}
var result = (num<0)?'minus ':'';
num = Math.abs(num);
@manuelvanrijn
manuelvanrijn / .gitignore
Created July 18, 2011 09:24
.gitignore template visual studio, nHibernate, ReSharper, MonoRail, Log4Net
# User-specific files
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb