Skip to content

Instantly share code, notes, and snippets.

@obfusk
obfusk / break.py
Last active September 2, 2024 16:23
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@bokmann
bokmann / ActiveRepository.rb
Created March 27, 2012 16:15
ActiveRepository Strawman
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
#
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
#
@dolzenko
dolzenko / factory_girl_debugging.rb
Created January 25, 2012 10:42
Commands to debug Factory Girl from console
require 'factory_girl_rails'
require 'rspec'
require 'rspec-rails'
require 'rspec/mocks/standalone' # => if factories need stubs (for remote services for example)
include FactoryGirl::Syntax::Methods # make FG methods available at top level, so you can do `> create :user`
def reload_factories!
FactoryGirl.instance_variable_set(:@factories, nil) # => clear loaded factories/sequences
# FactoryGirl.instance_variable_set(:@sequences, nil)
#! perl -w
# http://triplefusion.net/system/macosx-clipboard
# ----------------------------------------------------------------------
# File: macosx-clipboard
# ----------------------------------------------------------------------
#
# All portions of code are copyright by their respective author/s.
# Copyright (c) 2006 Samuel Ljungkvist <salj@triplefusion.net>
@bkudria
bkudria / flymake-fringe-icons.el
Created December 29, 2010 21:56
Add icons in the fringe, for flymake
(require 'fringe-helper)
(require 'flymake)
(defvar flymake-fringe-overlays nil)
(make-variable-buffer-local 'flymake-fringe-overlays)
(defadvice flymake-make-overlay (after add-to-fringe first
(beg end tooltip-text face mouse-face)
activate compile)
(push (fringe-helper-insert-region