Skip to content

Instantly share code, notes, and snippets.

# _/Users/pablo/go/src/github.com/phstc/putsreq/v8.go/src/github.com/idada/v8.go
../../v8_wrap.cc:291:40: error: too many arguments to function call, expected 0, have 1
../../v8_wrap.cc:55:27: note: expanded from macro 'PREV_CONTEXT_SLOT'
/usr/local/include/v8.h:6418:1: note: 'GetData' declared here
../../v8_wrap.cc:295:38: error: too many arguments to function call, expected single argument 'data', have 2 arguments
/usr/local/include/v8.h:6412:1: note: 'SetData' declared here
../../v8_wrap.cc:307:38: error: too many arguments to function call, expected single argument 'data', have 2 arguments
/usr/local/include/v8.h:6412:1: note: 'SetData' declared here
../../v8_wrap.cc:311:32: error: too many arguments to function call, expected 0, have 1
../../v8_wrap.cc:55:27: note: expanded from macro 'PREV_CONTEXT_SLOT'
@phstc
phstc / commit-msg-ruby.rb
Last active August 29, 2015 14:00
Prepend branch name in the commit messages
#!/usr/bin/env ruby
msg_file = ARGV[0]
commit_msg = File.read(msg_file).to_s.strip
def empty_commit?(commit_msg)
return true if commit_msg.empty?
commit_msg.split("\n").each do |line|
# Lines starting with '#' will be ignored
{
"title": "Email Schema",
"type": "object",
"required": [
"to",
"sender_email",
"template"
],
"properties": {
"sender_email": {
# Lock while executing `do_something` or expire in 10 seconds
Wombat::Mutex.exclusive 'my_key', 10 do
do_something
end
module Wombat
# @example Lock while executing `do_something` or expire in 10 seconds
# Wombat::Mutex.exclusive 'my_key', 10 do
# do_something
# end
#
class Mutex
class << self
# @param key [String] the lock key
# @param ttl [Fixnum] time to live in seconds
response.status = 200;
var payload = JSON.parse(request.body);
response.headers['Content-Type'] = 'application/json';
response.body = { "request_id": payload.request_id, "summary": "Hello " + payload['order']['id'] };
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
@phstc
phstc / scan.rb
Last active August 29, 2015 14:12
DynamoDB Parallel Scan
require 'aws-sdk'
require 'pry-byebug'
class MobyEvent
SCAN_WORKERS = 4
class << self
def client
@dynamodb ||= Aws::DynamoDB::Client.new(
region: 'us-east-1',
@phstc
phstc / query.go
Last active August 29, 2015 14:12
package main
import (
"fmt"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/dynamodb"
"log"
"os"
"time"
)