Skip to content

Instantly share code, notes, and snippets.

Kensuke Nagae kyanny

Block or report user

Report or block kyanny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View deferred_spec.coffee
describe "App.request", ->
deferred = null
beforeEach ->
deferred = $.Deferred()
sinon.stub(App, "request").returns deferred.promise()
afterEach ->
App.request.restore()
@willnet
willnet / create_image.rb
Created Mar 27, 2015
create image whose file size you can specify for test
View create_image.rb
#
# brew install imagemagick exiftool
#
system('convert -size 128x128 xc:blue test.jpg')
file_size = 1_048_576 - 448
ascii = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
File.open('random.txt', 'w') do |file|
file.write(file_size.times.map { ascii.sample }.join)
@rcrowley
rcrowley / gist:447393
Created Jun 21, 2010
Resque Nagios plugin
We couldn’t find that file to show.
View escfilter
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long qw(HelpMessage VersionMessage);
use Term::ANSIColor qw(colored);
our $VERSION = '0.01';
$VERSION = eval $VERSION;
my %color_map = (
@yoggy
yoggy / ldr2pin.rb
Created Jan 12, 2011
Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト
View ldr2pin.rb
#!/usr/bin/ruby
#
# ldr2pin.rb - Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト
#
$KCODE='utf8'
require 'rubygems'
require 'net/netrc'
require 'mechanize'
@tobert
tobert / config.ru
Created May 18, 2011
Gollum rackup for Unicorn
View config.ru
$: << 'lib'
require 'rubygems'
require 'gollum'
require 'gollum/frontend/app'
use Rack::ShowExceptions
Precious::App.set(:gollum_path, Dir.pwd)
Precious::App.set(:wiki_options, {})
@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

@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
@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?
You can’t perform that action at this time.