Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
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 March 27, 2015 11:59
create image whose file size you can specify for test
#
# 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 June 21, 2010 19:55
Resque Nagios plugin
We couldn’t find that file to show.
@kzys
kzys / escfilter
Created September 9, 2010 10:35 — forked from kyanny/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 January 12, 2011 06:19
Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト
#!/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 02:01
Gollum rackup for Unicorn
$: << '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 July 31, 2011 14:03
Common CoffeeScript Idoms - from the little book on CoffeeScript

Common CoffeeScript Idoms

Each

myfunction(item) for item in items

Map

@tricknotes
tricknotes / config.ru
Created November 12, 2011 05:59
config.ru for gollum
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
# 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
@tetsuok
tetsuok / complex_cube_root.go
Created April 2, 2012 09:23
An answer of the advanced exercise: complex cube roots on a tour of Go
package main
import (
"fmt"
"math/cmplx"
)
// FIXME:
// Currently calculate only real part of the input
// complex number.