Skip to content

Instantly share code, notes, and snippets.

View randito's full-sized avatar
:octocat:
(⊙_⊙)

Randy Pond randito

:octocat:
(⊙_⊙)
View GitHub Profile
@randito
randito / gist:3724898
Created September 14, 2012 21:16 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@randito
randito / anagram.rb
Created August 23, 2012 16:08
Little anagram checker. Had to find out if this tweet was true: https://twitter.com/crampell/status/238620771398864897
class String
def anagram?(other)
letter_count(self) == letter_count(other) # uses hash equivelence
end
private
# "wwaax" => { "w" => 2, "a" => 2, "x" => 1 }.. all others 0
def letter_count(str)
str.downcase.each_char.inject(Hash.new(0)) { |h, ch| h[ch] += 1; h }
end
@randito
randito / google_art_project-backbone_src.js
Created July 17, 2012 21:04
Google Art Project: Backbone js code. Beautified via http://jsbeautifier.org/
ap.globals.MainBaseView = Backbone.View.extend({
el: $("body"),
elements: {
$header: $("#header"),
$footer: $("#footer"),
$secondaryNav: $("nav.secondary"),
$pageContent: $(".content-wrapper"),
$mainContent: $(".main-content")
},
options: {
@randito
randito / gist:2997311
Created June 26, 2012 17:36 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#! /usr/bin/env ruby
# Generate all tags for all gems included by bundler in gems.tags
#
# Basically does the same as "bundle show gemname", except for all gems.
# Interestingly enough, "bundle show" without any arguments falls back to
# "bundle list", otherwise the whole thing could have been a bash one-liner.
require 'bundler'
@randito
randito / README.md
Created May 7, 2012 05:35
(Simplified) Example README for a DCI Ruby project in the works

Note: This version is a simplified version of this gist; it removes all the unnecessary features (like validations, required parameters, etc).

Data, Context, and Interaction

DCI is a modeling pattern by Trygve Reenskaug, creator of MVC, that is a replacement of sorts for typical OOP.

@randito
randito / README.md
Created May 7, 2012 00:18
Example README for a DCI Ruby project in the works

Note: A simplified version is available in this gist. It removes unnecessary stuff like validations, required parameters, etc.

Data, Context, and Interaction

DCI is a modeling pattern by Trygve Reenskaug, creator of MVC, that is a replacement of sorts for typical OOP.

DCI seperates the domain model (D - Data) from the use cases (C - Context)

@randito
randito / installation.sh
Created December 21, 2011 01:59 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
var CodeSnip = Backbone.Model.extend({
urlRoot: 'code_snips',
defaults: {
},
initialize: function () {
}
/*
*= require_self
*/
html, body {
background-color: #eee;
}
body {
padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
}