Skip to content

Instantly share code, notes, and snippets.

View theCrab's full-sized avatar
💭
What happens when you take a long holiday from work? Shit happens

The Crab theCrab

💭
What happens when you take a long holiday from work? Shit happens
View GitHub Profile
@collin
collin / gist:863025
Created March 9, 2011 21:18
delegate_and_let_and_rspec_and_rails.rb
# OMG you can use delegate in an rspec example.
# Make sure you have the active support delegate helpers included
# (You'll have this if you are using rails)
describe "Something" do
delegate(:this, :that, :the_other, :to => :object)
describe "as it is" do
let(:object) { Be.something }
it "delegates properly" do
@rkh
rkh / chat.rb
Created December 14, 2011 12:55
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@mfkp
mfkp / index.html
Created December 17, 2011 01:39
mailchimp ajax signup form example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@mcdonc
mcdonc / gist:3898894
Created October 16, 2012 12:11
oh my god i'm using emacs to reindent html in sublime text 2
# Sublime's HTML reindenting is currently pretty bad. And Tidy and xmllint
# change my code in ways I don't really like or need. I just need the thing
# reindented sanely. Emacs did that pretty well.
#
# One thing led to another. A few drinks later and now I'm using Emacs to
# reindent HTML from within Sublime.
#
# Save the contents of this file as ohmygodemacs.py in your User directory.
# Then save the contents of the following docstring as ohmygodemacs.elsip in your
# User directory
@mbj
mbj / run.rb
Created February 5, 2013 20:11
Because theCrab asked in #datamapper.
#!/usr/bin/env ruby
$: << 'lib'
require 'your_app'
Joy::Runner.run(YourApp.application)
@snusnu
snusnu / campaign_ideas.md
Created February 22, 2013 17:10
Collecting ideas for a crowdfunding campaign for DataMapper 2

What we're building

We need to describe the overall goal we're trying to achieve with DM2, break it up into manageable small steps and come up with a realistic timeframe / amount of hours to make it happen.

How to reach out

  • Look through lanyrd and ask people we know if they can spread the word about our campaign at conferences
  • Contact popular podcasts and ask if they're willing to feature our campaign and ask people to contribute
  • changelog
@mbj
mbj / veritas-s-exp.rb
Created February 27, 2013 17:18
Some nontrivial veritas s-expression.
[:join,
[:join,
[:base,
"people",
[[:id, Veritas::Attribute::Integer], [:name, Veritas::Attribute::String]]],
[:restrict,
[:base,
"people",
[[:id, Veritas::Attribute::Integer], [:name, Veritas::Attribute::String]]],
:true]],
@mbj
mbj / config.yml
Created February 28, 2013 20:30
dm2 components
repository_names:
- datamapper/dm-session
- datamapper/dm-mapper
- datamapper/dm-relation-graph
- datamapper/devtools
- dkubb/adamantium
- dkubb/ice_nine
- dkubb/equalizer
- dkubb/descendants_tracker
- dkubb/abstract_class
@twerth
twerth / example.rb
Created March 23, 2013 17:58
A simple example of creating a UIView with a UICollectionView as a subview in RubyMotion using Teacup for styling
# A simple example of creating a UIView with a UICollectionView as a subview
# in RubyMotion using Teacup for styling
#
# Your controller will need to set the stylesheet: stylesheet :example
# and create this view like so: subview Example, :my_example_view
class Example < UIView
CELL_IDENTIFIER = 'example_cell'
def initWithFrame(frame)