Skip to content

Instantly share code, notes, and snippets.

View kyanny's full-sized avatar

Kensuke Nagae kyanny

View GitHub Profile
[{"foo":"1"}]
@kyanny
kyanny / a.rb
Last active August 29, 2015 13:56
$ curl -s https://rubygems.org/api/v1/gems/diff-lcs.json
{
"dependencies": {
"runtime": [],
"development": [
{
"requirements": "~> 3.7",
"name": "hoe"
},
changeset: 203:31902182b995
branch: no35_translation
tag: tip
user: Kensuke Nagae <kyanny@gmail.com>
date: Thu Mar 20 02:51:03 2014 +0900
summary: Fix Japanese translation of No.35
diff -r c892a61a8dc7 -r 31902182b995 content/tour.article.jp
--- a/content/tour.article.jp Thu Jan 09 21:23:38 2014 +0900
+++ b/content/tour.article.jp Thu Mar 20 02:51:03 2014 +0900
package main
import "fmt"
func adder (n int) func() int {
sum := 0
return func () int {
sum += n
return sum
}
a?= 1
@kyanny
kyanny / 01_test.rb
Last active August 29, 2015 13:58
Inconsistent results of Draper::Decorator#decorate_collection and Draper:: Decoratable#decorate
require 'rails'
require 'mongo_mapper'
require 'draper'
require 'rspec'
MongoMapper.database = 'testing'
MongoMapper::Document.send(:include, Draper::Decoratable)
class Bookmark
include MongoMapper::Document
@kyanny
kyanny / gist:11023320
Created April 18, 2014 03:19
$ ruby -e 'loop.with_index{|i,j| p [i,j]}' > a.txt
[nil, 0]
[nil, 1]
[nil, 2]
[nil, 3]
[nil, 4]
[nil, 5]
[nil, 6]
[nil, 7]
[nil, 8]
[nil, 9]
@kyanny
kyanny / Gemfile
Created May 17, 2014 19:08
newrelic_rpm 3.8.1.221 and newrelic-grape crash minimum replicate code: uninitialized constant NewRelic::MetricSpec (NameError)
source "https://rubygems.org"
gem 'grape'
gem 'newrelic_rpm', '3.8.1.221'
gem 'newrelic-grape'
@kyanny
kyanny / capybara
Last active August 29, 2015 14:01
Capybara console
#!/usr/bin/env ruby
require 'pry'
require 'capybara/dsl'
require 'capybara/poltergeist'
require 'uri'
include Capybara::DSL
Capybara.default_driver = :poltergeist
describe "App.request", ->
deferred = null
beforeEach ->
sinon.stub(App, "request").yieldsTo('done', {res: "ok"})
afterEach ->
App.request.restore()