This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faker' | |
module Faker | |
class Markdown < Lorem | |
class << self | |
def sentence(*args) | |
super[0..-2] | |
.gsub(/[^ ]+/) { |m| modify m } | |
.sub(/\A /, '') | |
.sub(/ \z/, '') + '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tmpdir' | |
require 'timeout' | |
require 'erb' | |
require 'rack' | |
require 'rack-livereload' | |
require 'redcarpet' | |
require 'pygments' | |
require 'eventmachine' | |
require 'em-websocket' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function funcA() { | |
ROOM=foo | |
} | |
function funcB() { | |
echo $ROOM | |
} | |
funcA && funcB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'strscan' | |
module Parser | |
E = %r'='.freeze | |
NE = %r'[^=]+'.freeze | |
Q = %r'"'.freeze | |
NQ = %r'[^"]+'.freeze | |
S = %r'\s'.freeze | |
NS = %r'\S+'.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-eval-after-load 'web-mode | |
(dolist (face-name (face-list)) | |
(if (face-italic-p face-name) | |
(message "%s" face-name))) | |
;; イタリックを解除する | |
(let ((italic-web-mode-faces (delq nil (mapcar '(lambda (face-name) | |
(if (and (face-italic-p face-name) | |
(string-match "^web-mode-" (symbol-name face-name))) | |
face-name)) (face-list))))) | |
(dolist (face-name italic-web-mode-faces) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
require 'ostruct' | |
require 'nokogiri' | |
require 'open-uri' | |
xml = Nokogiri::XML(open('http://unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml')) | |
# https://github.com/AtelierConvivialite/locale_data/blob/master/data/cldr_1.9.1/common/dtd/ldmlSupplemental.dtd#L76-L83 | |
# https://github.com/AtelierConvivialite/locale_data/blob/master/data/cldr_1.9.1/common/dtd/ldmlSupplemental.dtd#L90-L97 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.localForage = {} | |
Backbone.localForage.sync = (prefix) -> | |
(method, model, options) -> | |
options.success ?= -> | |
options.error ?= -> | |
save = (key, options) -> | |
localforage.setItem key, model.toJSON(), (err, val) -> | |
if err | |
options.error err | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Stripe | |
module APIOperations | |
module List | |
module ClassMethods | |
def find_each(filters={}, api_key=nil, &block) | |
loop do | |
list = all(filters, api_key).tap { |e| e.each(&block) } | |
break unless list.has_more | |
filters = filters.merge(starting_after: list.data.last.id) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thu, 08 Jan 2015 00:00:00 EST -05:00 : Thu, 08 Jan 2015 05:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 01:00:00 EST -05:00 : Thu, 08 Jan 2015 06:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 02:00:00 EST -05:00 : Thu, 08 Jan 2015 07:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 03:00:00 EST -05:00 : Thu, 08 Jan 2015 08:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 04:00:00 EST -05:00 : Thu, 08 Jan 2015 09:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 05:00:00 EST -05:00 : Thu, 08 Jan 2015 10:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 06:00:00 EST -05:00 : Thu, 08 Jan 2015 11:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 07:00:00 EST -05:00 : Thu, 08 Jan 2015 12:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 08:00:00 EST -05:00 : Thu, 08 Jan 2015 13:00:00 UTC +00:00 | |
Thu, 08 Jan 2015 09:00:00 EST -05:00 : Thu, 08 Jan 2015 14:00:00 UTC +00:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
class Doc | |
include MongoMapper::Document | |
one :em_doc | |
timestamps! | |
ensure_index [['em_doc.foo', Mongo::ASCENDING]] | |
end |
OlderNewer