Skip to content

Instantly share code, notes, and snippets.

View nilcolor's full-sized avatar
💫
API by day, IPA by night

Alexey Blinov nilcolor

💫
API by day, IPA by night
View GitHub Profile
@nilcolor
nilcolor / rspec-syntax-cheat-sheet.rb
Created May 4, 2012 06:36 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@nilcolor
nilcolor / init.el
Created April 20, 2012 09:11 — forked from mig/init.el
Simple Emacs 24 configuration for Rails development
;; emacs configuration
(push "/usr/local/bin" exec-path)
(add-to-list 'load-path "~/.emacs.d")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
@nilcolor
nilcolor / bdb.coffee
Created April 13, 2012 11:17
"Быстрый" датабиндинг для Backbone.js
events:
"change input": "fieldChanged",
"change select": "selectionChanged",
selectionChanged: (event) ->
field = $ event.currentTarget
value = $("option:selected", field).val()
data = {}
data[field.attr 'id'] = value
@nilcolor
nilcolor / bdb.js
Created April 13, 2012 11:14
"Быстрый" датабиндинг для Backbone.js
events: {
"change input": "fieldChanged",
"change select": "selectionChanged",
},
selectionChanged: function(e){
var field = $(e.currentTarget);
var value = $("option:selected", field).val();
var data = {};
data[field.attr('id')] = value;
@nilcolor
nilcolor / .ackrc
Created April 13, 2012 09:06
ack[_grep] setup
#~/.ackrc
--type-add
html=.erb,.haml,.jade
--type-set
scripts=.js,.coffee
--type-set
styles=.css,.scss,.sass,.less
--ignore-dir=node_modules
--ignore-dir=vendor # you still can ack in vendor files - just `cd vendor && ack ...`
@nilcolor
nilcolor / gist:1393643
Created November 25, 2011 14:30
ido-find-file
;; use ido for minibuffer completion
(require 'ido)
(ido-mode t)
(setq ido-save-directory-list-file "~/.emacs.d/.ido.last")
(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point 'guess)
(setq ido-show-dot-for-dired t)
@nilcolor
nilcolor / →GReader
Created November 8, 2011 07:25
Bookmarklet that helps you to subscribe for current site's RSS in Google Reader
javascript:var%20b=document.body;var%20GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/subscribe-bookmarklet.js');void(b.appendChild(z));}else{location='http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href)}
@nilcolor
nilcolor / speetter.py
Created October 20, 2011 19:09 — forked from bobuk/speetter.py
Говорилка
# -*- coding: utf-8 -*-
# получить twitter можно командой `pip install twitter`
import sys;reload(sys);sys.setdefaultencoding('utf-8')
import twitter
import time
import commands, itertools
consumer_key = ...
consumer_secret = ...
access_key = ...
@nilcolor
nilcolor / views.py
Created October 12, 2011 13:56
@view_config
class FuckyView(object):
def __init__(self, request):
self.request = request
@view_config(context="starter.resources.Bar")
def fucky(request):
return Response('fucky view')
@nilcolor
nilcolor / gist:1031338
Created June 17, 2011 12:36
JavaScript vs Python
//JavaScript
function _A(num){
var o = {};
o.a = num;
o.square = function(){
return o.a * o.a;
};
return o;