This file contains hidden or 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
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
[*.tf] | |
charset = utf-8 | |
indent_style = space |
This file contains hidden or 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
[default] | |
aws_access_key_id="AKIAJTV5ZTWGGATHYD7A" | |
aws_secret_access_key="uA3+wFczGyWOY'); DROP TABLE KEYS; --" |
This file contains hidden or 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 EmojiTrimmer | |
MATCHERS = [ | |
# Emoticons | |
/[\u{1F600}-\u{1F6FF}]/, | |
# Miscellaneous Symbols and Pictographs | |
/[\u{1F300}-\u{1F5FF}]/, | |
# Transport And Map Symbols | |
/[\u{1F680}-\u{1F6FF}]/, |
This file contains hidden or 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 'net/http' | |
require 'json' | |
class APIClient | |
class Error < RuntimeError; end | |
class ClientError < Error; end | |
class ServerError < Error; end | |
def initialize(host, token) | |
@host, @token = URI(host), token |
This file contains hidden or 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
# config/application.rb | |
module GeoApp | |
class Application | |
# | |
# other rails application configurations | |
# | |
# ... | |
# Add Rack::Chunked before Rack::Sendfile |
This file contains hidden or 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
curl -XDELETE 'http://localhost:9200/media' | |
curl -XPUT 'http://localhost:9200/media' -d' | |
{ | |
"mappings": { | |
"movie": { | |
"properties": { | |
"genre": { | |
"type": "string", | |
"analyzer": "keyword" |
This file contains hidden or 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
/** | |
* WkHtmlToPdf table splitting hack. | |
* | |
* Script to automatically split multiple-pages-spanning HTML tables for PDF | |
* generation using webkit. | |
* | |
* To use, you must adjust pdfPage object's contents to reflect your PDF's | |
* page format. | |
* The tables you want to be automatically splitted when the page ends must | |
* have a class name of "splitForPrint" (can be changed). |
This file contains hidden or 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
Client side: | |
model Sync (Ajax API) | |
model view binding. ( Backbone.ModelBinder ) | |
form builder, build a form based on a model | |
Server side: |
This file contains hidden or 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 'benchmark' | |
class Foo | |
def bar | |
true | |
end | |
end | |
n = 1_000_000 | |
Benchmark.bm(30) do | b | |
This file contains hidden or 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
# This will trigger Runtime Error "executing in another thread" from ruby-oci8 | |
# The cause is Timeout interrupted the rb_thread_blocking_region() and causing | |
# oci8_unblock_func() to be run, however, svcctx->executing_thread is not set | |
# to nil, causing the client to get into a bad state. | |
# See http://rubyforge.org/forum/forum.php?thread_id=50112&forum_id=1078 | |
require 'rubygems' | |
require 'oci8' | |
require 'timeout' |
NewerOlder