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 'async-rack' | |
require 'rack/cache' | |
module Rack::Cache | |
class Context | |
include AsyncRack::AsyncCallback::Mixin | |
def async_callback(result) | |
response = Response.new(*result) | |
@request ||= Request.new(env.dup.freeze) | |
store response if response.cacheable? |
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
# Demo http://ascii.io/a/3019 | |
# build | |
gdbb () { | |
# build with debug flags | |
go build -gcflags "-N -l" -o out | |
# make sure the build didn't fail | |
if [ $? != 0 ]; then return; fi |
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
<?php | |
namespace MyProject\Cli\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class DbMigrate extends \Symfony\Component\Console\Command\Command | |
{ |
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 'sinatra' | |
require 'redis' | |
require 'json' | |
require 'date' | |
class String | |
def &(str) | |
result = '' | |
result.force_encoding("BINARY") |
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
func whenInitial(wt *fsm.FSM) fsm.StateFunction { | |
return func(event *fsm.Event) *fsm.NextState { | |
transfer, transferOk := event.Message.(*Transfer) | |
if transferOk && event.Data == nil { | |
transfer.source <- transfer.amount | |
return wt.Goto(AwaitFromState).With( | |
&WireTransferData{transfer.source, transfer.target, transfer.amount, wt}, | |
) | |
} | |
return wt.DefaultHandler()(event) |
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
#!/usr/bin/env sh | |
# Download lists, unpack and filter, write to stdout | |
curl -s https://www.iblocklist.com/lists.php \ | |
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| xargs wget -O - \ | |
| gunzip \ | |
| egrep -v '^#' |