Skip to content

Instantly share code, notes, and snippets.

@tenderlove
tenderlove / a_query.rb
Created April 12, 2011 17:08
An example using lolquery
###
# lolquery is an fresh new take on SQL DSLs. NEVER WRITE SQL AGAIN! Using
# amazing lolquery technology, you too will never have to write another SQL
# statement again!
#
# Check out this simple example of using lolquery. Bask in it's simplicity,
# it's expressiveness, but most importantly, it's lack of writing SQL!
#
# <3 <3 <3 <3 <3
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@solnic
solnic / osx_rails_env_setup_in_6_steps.md
Created March 29, 2012 12:33
6 steps to get up'n'running with Rails on OS X

6 steps to set up a rails development environment on OS X:

  • install Apple Command Line Tools
  • install homebrew[1]: /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
  • install rvm: bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
  • install ruby rvm install 1.9.3
  • install rails
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jetsanix
jetsanix / html5-notifications.md
Created July 12, 2012 09:22
OS X Notification Center in Safari 6 & Chrome 21+

OS X Notification Center in Safari 6 & Chrome 21+

OS X Mountain Lion adds Notification Center for managing alerts. Just like growl, but better.

Safari 6 and latest Chrome (21+) expose HTML5 notifications API to sites. Every site need to have permission for showing notifications.

Specification is very new and completely different from older version Chrome had. Developer doesn't have to watch for complicated NotificationCenter.

The syntax is very simple:

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@kwhinnery
kwhinnery / buble.js
Created March 5, 2013 19:28
Bublé - a shitty version of Sinatra in 50 lines of node.js code.
var http = require('http'),
url = require('url');
module.exports = function(ctx) {
//Initially the global scope, but will be overridden per request
var context = ctx || this,
routes = {};
//Allow users to handle a GET
context.get = function(route, handler) {
@rbnpi
rbnpi / A_README SONIC_PI PLAY FILES
Last active June 17, 2017 01:14
Sonic-Pi music files for Raspberry PiGraphic Desktop
THESE FILES WERE WRITTEN FOR SONIC PI VERSION 1
THEY WILL REQUIRE REVISION TO WORK ON VERSION 2
I HAVE OTHER FILES FOR VERSION 2 POSTED ON MY BLOG
SOME OF THESE FILES ARE POSTED THERE IN REVISED VERSIONS
http://rbnrpi.wordpress.com
Posted here will be music files for use with Sonic-Pi on the Raspberry Pi.
If you have the Sonic-Pi music program isntalled (it is on the latest distribution for Raspian) you can start it up from the Graphic Desktop (there is a link under Education on the Start Menu). You can then copy and past the contents of one of the play files into one of the 8 workspace windows and click play to play it.
@jamonholmgren
jamonholmgren / user_controller.rb
Created October 23, 2013 19:06
Cleaner params
class UserController < ApplicationController
def create
@user = User.create(UserInput.new(params).create)
end
def update
@user = User.find(params[:id].to_i)
@user.update_attributes(UserInput.new(params).update)
end
@rkh
rkh / warning_filter.rb
Created February 21, 2014 07:45
Run Ruby with warnings enabled. Without going crazy.
require 'delegate'
module Support
class WarningFilter < DelegateClass(IO)
def write(line)
super if line !~ /^\S+gems\/ruby\-\S+:\d+: warning:/
end
end
end