Skip to content

Instantly share code, notes, and snippets.

View icidasset's full-sized avatar
🪴

Steven Vandevelde icidasset

🪴
View GitHub Profile
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'
@ryanb
ryanb / README.md
Created May 15, 2011 16:24 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb
@gilesbowkett
gilesbowkett / wtf.rb
Created May 25, 2011 21:16
Comment out one line to avoid RubyGems nonsense
49 def deprecate name, repl, year, month
50 class_eval {
51 old = "_deprecated_#{name}"
52 alias_method old, name
53 define_method name do |*args, &block| # TODO: really works on 1.8.7?
54 klass = self.kind_of? Module
55 target = klass ? "#{self}." : "#{self.class}#"
56 msg = [ "NOTE: #{target}#{name} is deprecated",
57 repl == :none ? " with no replacement" : ", use #{repl}",
58 ". It will be removed on or after %4d-%02d-01." % [year, month],
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@kevinold
kevinold / deploy.rb
Created July 26, 2011 20:55 — forked from jeronimo/deploy.rb
Capistrano recipe to sync rails MongoDB and files
set :sync_directories, ["public/system/images"]
set :sync_backups, 3
set :db_file, "mongoid.yml"
set :db_drop, '--drop' # drop database (rewrites everything)
@wojtekmach
wojtekmach / post_test.rb
Created August 28, 2011 12:33
minitest + shoulda-matchers
gem "minitest"
require "minitest/spec"
require "minitest/autorun"
require "active_model"
require "turn"
require "shoulda-matchers"
class MiniTest::Unit::TestCase
include Shoulda::Matchers::ActiveModel
extend Shoulda::Matchers::ActiveModel
@helloluis
helloluis / Slim HTML5 Boilerplate Conditional Comments
Created August 31, 2011 08:52
How to get HTML5 Boilerplate-style Conditional Comments Working in Slim
doctype html
/[if lt IE 7]
| <html class="ie6">
/[if IE 7]
| <html class="ie7">
/[if IE 8]
| <html class="ie8">
/[if IE 9]
| <html class="ie9">
| <!--[if (gte IE 9)|!(IE)]<!--> <html> <!--<![endif]-->
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
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
@bentruyman
bentruyman / slug.js
Created September 12, 2011 14:31
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@lightyrs
lightyrs / apple_browser_detect.js
Created October 16, 2011 19:05
How Apple does browser detection
SC._detectBrowser = function(userAgent, language) {
var version, webkitVersion, browser = {};
userAgent = (userAgent || navigator.userAgent).toLowerCase();
language = language || navigator.language || navigator.browserLanguage;
version = browser.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/) || [])[1];
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1];
browser.windows = browser.isWindows = !! /windows/.test(userAgent);
browser.mac = browser.isMac = !! /macintosh/.test(userAgent) || (/mac os x/.test(userAgent) && !/like mac os x/.test(userAgent));
browser.lion = browser.isLion = !! (/mac os x 10_7/.test(userAgent) && !/like mac os x 10_7/.test(userAgent));
browser.iPhone = browser.isiPhone = !! /iphone/.test(userAgent);