Skip to content

Instantly share code, notes, and snippets.

Avatar

Orlin M Bozhinov orlin

  • Astrolet
  • Varna, Bulgaria
  • Twitter @orlin
View GitHub Profile
@bernerdschaefer
bernerdschaefer / gist:962715
Created May 9, 2011
some bash helpers for working with padrino projects
View gist:962715
alias rake="time rake"
# Run `padrino rake` when inside a padrino project,
# otherwise run the normal rake command.
function rake () {
if [[ -f ".components" ]]; then
padrino rake $*
else
ruby -S rake $*
fi
@igrigorik
igrigorik / TweetEvent.java
Created May 27, 2011
wrapping esper with JRuby embrace
View TweetEvent.java
// A simple Tweet POJO:
// $> javac TweetEvent.java
public class TweetEvent {
private String user;
private String text;
private String timezone;
private int retweets;
public TweetEvent(String user, String text, String timezone, int retweets) {
@jicksta
jicksta / gist:1001736
Created Jun 1, 2011
Jasmine shared behavior for asserting that a certain event on an element exposed as a Backbone view property properly executes the expected view instance method
View gist:1001736
function assertViewAction(viewClass, eventCallbackName, elementAccessorName, eventName, viewReference) {
it("should run the " + eventCallbackName + " action when the " + elementAccessorName + " gets a " + eventName + " event (assertViewAction)", function() {
var isPrototypal = eventCallbackName in viewClass.prototype;
if (isPrototypal) {
spyOn(viewClass.prototype, eventCallbackName);
}
var view = viewReference();
if (!isPrototypal) {
spyOn(view, eventCallbackName);
}
@kriszyp
kriszyp / my-widget.js
Created Jun 24, 2011
This is how I want to write structured documentation and unit tests
View my-widget.js
/* This is the module, the implementation, distinct from the specification/interface. */
define([...deps...], function(){
return function(options){
...
};
});
@topfunky
topfunky / new-github.sh
Created Jul 25, 2011
Shell shortcut to setup a Git repo with GitHub. Works with zsh or bash.
View new-github.sh
# Usage: new-github topfunky tidy_table
function new-github() {
git remote add origin git@github.com:$1/$2.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
View gist:1211737
How to add cmd-left-arrow and cmd-right-arrow (without shift) key bindings to the mac os x Terminal
app if the Lion install removed this bindings from your system.
1) Open "System Preferences".
2) Go to "Keyboard".
3) Select the "Keyboard Shortcuts" tab.
4) Select "Application Shortcuts" from the list of items in the left.
5) Press "+" to add a new shurtcut.
6) As "Application" select "Terminal", as "Menu Title" use: "Select Next Tab". For the "Keyboard Shortcut" field just select the field and press cmd-right-arrow.
7) Repeat again from step 5, using "Select Previous Tab" as Menu Title and pressing cmd-left-arrow as keyboard shortcut.
@ded
ded / cmd
Created Sep 21, 2011
ender | backbone
View cmd
ender build backbone
View gist:1269191
ab -t 10 -c 100 http://127.0.0.1:8000/bytes/12 against benchmark/http_simple.js OSX x64 build
v0.1.13 4792.77 req/sec
v0.2.6 4977.69
v0.4.12 5878.03
v0.5.9-pre 5912.16
@substack
substack / gist:1482822
Created Dec 15, 2011
how testling implements http 402 responses (payment required)
View gist:1482822
...
auth.usage(req.user, function (err, usage) {
if (usage && usage.used > usage.limit) {
res.statusCode = 402;
res.write('You have used '
+ Math.floor(usage.used / 60)
+ ' minutes but your plan is only good for '
+ Math.floor(usage.limit / 60)
+ ' minutes per month!\r\n\r\n'
@mislav
mislav / readme.md
Created Jan 25, 2012
CLI tool that checks the build status of current branch on Travis CI
View readme.md

Check build status of a project on the command line

Install (copy & paste):

curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
  && chmod +x ~/bin/travis

gem install hub | tail -2
ruby -e 'require "json"' 2>/dev/null || gem install json