Skip to content

Instantly share code, notes, and snippets.

@phreax
phreax / coding_mistakes.py
Last active May 27, 2019 09:52
Python Coding Mistakes
# Case 1
def append_index(idx=0, ids=[]):
ids.append(idx)
print(idx)
print(ids)
append_index(idx=1)
append_index(idx=2)
@phreax
phreax / backtrace
Created May 21, 2012 15:22
rails backtrace, display builder
haml (3.1.5) lib/haml/helpers/action_view_mods.rb:93:in `capture_with_haml'
config/initializers/display_helper.rb:16:in `display_for'
app/views/duties/_show.html.haml:1:in `_app_views_duties__show_html_haml__160992557_80864300'
actionpack (3.2.3) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.3) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.3) lib/action_view/template.rb:141:in `render'
actionpack (3.2.3) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.3) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
@phreax
phreax / rspec_error.log
Created March 21, 2012 14:10
error with rspec and ruby 1.9.2 in chili project
$ rspec
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on o
r after 2011-11-01.
Gem.source_index called from /home/michat/.rvm/gems/ruby-1.9.2-p318@bagel/gems/r
ails-2.3.14/lib/rails/gem_dependency.rb:21.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on o
r after 2011-11-01.
Gem.source_index called from /home/michat/.rvm/gems/ruby-1.9.2-p318@bagel/gems/r
@phreax
phreax / inter_spec.js
Created April 5, 2011 18:37
specification of changes middleware
var vows = require('vows');
var assert = require('assert');
var app = require('app'),
db = app.db;
var inter = inter;
var http = require('http');
var sys = require('sys');
var _ = require('underscore');
var request = require('request');
var path = require('path');
@phreax
phreax / inter.js
Created April 4, 2011 21:27 — forked from aflatter/inter.js
var app = require('app')
var assert = require('assert')
var db = app.db;
var get_state = function(cb) {
db.get('_state', function(err,doc) {
if(err) {
@phreax
phreax / inter.js
Created April 4, 2011 20:50
still not working
var app = require('app')
var assert = require('assert')
var db = app.db;
var get_state = function(cb) {
db.get('_state', function(err,doc) {
if(err) {
@phreax
phreax / inter.js
Created April 4, 2011 19:55
couchdb act on changes with node
var app = require('app')
var assert = require('assert')
var db = app.db;
var get_state = function() {
db.get('_state', function(err,doc) {
if(err) {