Skip to content

Instantly share code, notes, and snippets.

View warseph's full-sized avatar
🏠
Working from home

Ezequiel Rabinovich warseph

🏠
Working from home
View GitHub Profile
// ==UserScript==
// @name Countdown Timer
// @namespace http://warseph.com/
// @version 0.11
// @description Add a countdown timer to any page
// @author Ezequiel Rabinovich
// @match http*://*/*
// @grant GM_setValue
// @grant GM_getValue
// @updateURL https://gist.githubusercontent.com/warseph/69a3332d9268b9e98ad3bda5d8e72ed5/raw/countdown-timer.user.js
### Keybase proof
I hereby claim:
* I am warseph on github.
* I am warseph (https://keybase.io/warseph) on keybase.
* I have a public key whose fingerprint is 11A0 22FC FCEA 3689 BECC C906 1CF1 AB20 1FB7 846D
To claim this, I am signing this object:
@warseph
warseph / .slate
Created November 5, 2014 15:16
Slate change monitor
# Move windows between monitors
alias mon-left 0
alias mon-right 1
bind left:${hyper} move screenOriginX;screenOriginY screenSizeX;screenSizeY mon-left
bind right:${hyper} move screenOriginX;screenOriginY screenSizeX;screenSizeY mon-right
Number::second = Number::seconds = -> this * 1000
Number::minute = Number::minutes = -> this.seconds() * 60
Number::hour = Number::hours = -> this.minutes() * 60
Number::day = Number::days = -> this.hour() * 24
# example
setTimeout (-> console.log "You've waited a LONG time"), 1.hour() + 5.minutes() + 10.seconds() # Wait 01:05:10
@warseph
warseph / promises.coffee
Created March 14, 2014 17:12
Simple promises example
Q = require 'q'
receivePromise = (func) ->
(args...) -> Q.spread args, func
returnPromise = (func) ->
(args...) ->
deferred = Q.defer()
args.push (val) -> deferred.resolve val
func args...
@warseph
warseph / tab_color.fish
Created June 6, 2013 22:24
Set iTerm's tab color
function tab_color -d "Sets the tab color in iterm"
bash -c "echo -e '\033]6;1;bg;red;brightness;$argv[1]\a \033]6;1;bg;green;brightness;$argv[2]\a \033]6;1;bg;blue;brightness;$argv[3]\a'"
end
#e.g. tab_color 164 205 56
@warseph
warseph / lock.js
Created February 25, 2013 19:04
Simple function locking in javascript
var lock;
lock = function (object, functionName, lockFunction) {
'use strict';
var old;
if (object[functionName].locked) {
return false;
}
@warseph
warseph / gist:5016395
Last active December 14, 2015 02:49
Javascript apply/call examples
// Basic call - apply
var test = function (a, b) {
return a + b;
}
test(1, 2); // 3
test.apply(null, [1, 2]); // 3
test.call(null, 1, 2); // 3
@warseph
warseph / todos.sh
Created January 10, 2013 14:52
Print all */*.TODO files in a folder (to use with sublime PlainTasks and GeekTools)
#!/bin/bash
for TODO in `ls $1/*/*.TODO`
do
printf '\033[34m=================================\n'
dirname $TODO | awk '{print toupper($0)}'
printf '=================================\033[0m\n'
cat $TODO | perl -C -e 'use utf8;' -pe 's/✔/\033[32m✔\033[0m/i' | perl -C -e 'use utf8;' -pe 's/(^[^:]+:$)/\033[31m$1\033[0m/i'
echo
echo
done
@warseph
warseph / gist:4409089
Last active December 10, 2015 08:38
Mongoose example
// models.js
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
model = mongoose.model;
var userSchema = new Schema({
name: String,
email: ObjectId,
password: String