Skip to content

Instantly share code, notes, and snippets.

Avatar

Kensuke Nagae kyanny

View GitHub Profile
@twilson63
twilson63 / csidoms.md
Created Jul 31, 2011
Common CoffeeScript Idoms - from the little book on CoffeeScript
View csidoms.md

Common CoffeeScript Idoms

Each

myfunction(item) for item in items

Map

@wsargent
wsargent / gist:1258640
Created Oct 3, 2011
Setting up a base vagrant box for Oracle
View gist:1258640
Install instructions for 10.2:
http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b15666/toc.htm
http://download.oracle.com/docs/cd/B19306_01/install.102/b15667/toc.htm
[Required files]
10201_database_linux_x86_64.cpio.gz
10201_companion_linux_x86_64.cpio.gz
p6810189_10204_Linux-x86-64.zip
@tricknotes
tricknotes / config.ru
Created Nov 12, 2011
config.ru for gollum
View config.ru
require 'rubygems'
require 'bundler/setup'
require 'gollum/frontend/app'
Precious::App.set(:gollum_path, File.dirname(__FILE__))
Precious::App.set(:wiki_options, {})
run Precious::App
View base_model.rb
# app/models/my_model.rb
module MyApp
module Model
def self.included(base)
base.send :include, Mongoid::Document
base.send :include, Mongoid::Timestamps
base.send :include, ActiveAdmin::Mongoid::Patches
end
end
@simenbrekken
simenbrekken / add.js
Created Nov 24, 2011
Backbone.js form submission
View add.js
define([
'backbone',
'underscore',
'project/views/form'
], function(Backbone, _, ProjectFormView) {
var View = Backbone.View.extend({
events: {
'submit form': 'submit'
},
@fairchild
fairchild / Gemfile
Created Dec 7, 2011
An example sinatra omniauth client app
View Gemfile
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
@flavio
flavio / gemfile_lock2geminabox.rb
Created Feb 2, 2012
Parse Gemfile.lock, download all gems from rubygems and then upload them to a local instance of geminabox
View gemfile_lock2geminabox.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler'
require 'fileutils'
require 'net/http'
require 'net/https'
require 'uri'
TMP_DIR = "/tmp/gems"
@jgorset
jgorset / gist:1747655
Created Feb 5, 2012
How Sprockets works with JST and EJS templates
View gist:1747655
// This document distills the magic that happens when you create a file with the ".jst"
// and ".ejs" extensions anywhere on your asset path in Ruby on Rails, courtesy of the
// Sprockets library (https://github.com/sstephenson/sprockets).
//
// For the purpose of this example, imagine that you have created a template for
// messages in `app/assets/javascripts/backbone/templates/messages/message.jst.ejs`
// with the following contents:
//
// <h1><%= user.full_name %></h1>
// <p><%= body %></p>
@larsrottmann
larsrottmann / active_admin_mongomapper_patches.rb
Created Feb 15, 2012
Enable basic MongoMapper support in ActiveAdmin
View active_admin_mongomapper_patches.rb
# config/initializers/active_admin_mongomapper_patches.rb
require "active_admin"
require "active_admin/resource_controller"
require 'ostruct'
module ActiveAdmin
class Namespace
# Disable comments
def comments?
@tetsuok
tetsuok / complex_cube_root.go
Created Apr 2, 2012
An answer of the advanced exercise: complex cube roots on a tour of Go
View complex_cube_root.go
package main
import (
"fmt"
"math/cmplx"
)
// FIXME:
// Currently calculate only real part of the input
// complex number.