Skip to content

Instantly share code, notes, and snippets.

@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'

RSpec 3 syntax is more verbose.

About twice as many characters to type to stub something:

obj.stub(client: client)                          # old
allow(obj).to receive(:client).and_return(client) # new
allow(obj).to receive(client: client)             # possible? still much longer
allow(obj, client: client)                        # I might wrap it in this
@runefs
runefs / gist:4621229
Last active December 11, 2015 15:29
This is an example of how DCI can be done in Ruby without injecting methods into objects. It's inspired by how the Marvin compiler works, and is basically rewritting method calls on a RolePlayer into a method call on the context object when the method being cllaed is a role method. It does not work completely like marvin E.g. any access to a rol…
require 'live_ast'
require 'live_ast/to_ruby'
module Player
alias metho_missing_org method_missing
def method_missing (name, *args)
current = Context.current
raise "no current context" unless current
role_name = current.role_name
method_name = "self_#{role_name}_#{name}".to_sym
@alphazo
alphazo / .gitignore
Last active October 12, 2015 21:39
ArchLinux Installation Guide - Encrypted SSD (GPT/GRUB2/LUKS/LVM/Systemd)
*.*~
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@smd686s
smd686s / Gemfile
Created May 12, 2012 16:29
Goliath.io with Grape and MongoDB
gem 'mongo'
gem 'em-mongo'
gem 'bson_ext'
gem 'goliath'
gem 'grape'
@isc
isc / README.markdown
Created March 19, 2012 15:58
A micro gem providing an accordion view helper and a tabs view helper that generate the proper markup for Twitter Bootstrap

Twitter Bootstrap Components Helper

Provides an accordion helper and a tabs helper

In your Gemfile:

gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'

Accordion helper:

@geuis
geuis / remote-typeahead.js
Created February 16, 2012 22:58
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
@sr
sr / Gemfile
Created December 19, 2011 13:55
Janky on Heroku
source "http://rubygems.org"
gem "janky", "~>0.9"
gem "pg"
gem "thin"
@durran
durran / simple_form.rb
Created September 16, 2011 11:25
Mongoid with simple form.
module SimpleForm
class FormBuilder
alias _find_association_reflectio find_association_reflection
def find_association_reflection(association) #:nodoc:
if reflection = _find_association_reflectio(association)
ActiveModelMetadataProxy.new reflection
end
end