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
type Repository struct { | |
Name string `json:"name"` | |
Description string `json:"description"` | |
Private bool `json:"private"` | |
} | |
// response to blog post https://willnorris.com/2014/05/go-rest-apis-and-pointers | |
type RepositoryPatch struct { | |
Repository |
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 v(dfrom, dto) as ( | |
VALUES('2014-01-01'::date, '2014-11-12'::date) | |
--VALUES(_from, _to) | |
), failures as ( | |
select user_id, 'data-entry'::citext as action, count(*) as "count" from ad_histories, v | |
where action='qc-fail' and created_at>=v.dfrom and created_at<=v.dto | |
and exists(select 1 from ad_histories subq where ad_id=subq.ad_id and subq.action='data-entry' limit 1) group by user_id | |
), elapsed as ( | |
select r.user_id,r.action,avg(r.elapsed) as "avg_time" from ( | |
select user_id,action, lead(created_at,1,now()) over w - created_at as elapsed |
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
# Install dependencies | |
# | |
# * checkinstall: package the .deb | |
# * libpcre3, libpcre3-dev: required for HTTP rewrite module | |
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module | |
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \ | |
mkdir -p ~/sources/ && \ | |
# Compile against OpenSSL to enable NPN |
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
defmodule Rocket.Stringer do | |
def sanitize_phone(ph) do | |
ph = Regex.replace(~r/[^0-9]/,ph,"") | |
case Regex.run(~r/\d{5,10}$/,ph) do | |
[phone] -> phone | |
_ -> nil | |
end | |
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
Summary: | |
Total: 13.0664 secs. | |
Slowest: 0.3004 secs. | |
Fastest: 0.0760 secs. | |
Average: 0.1303 secs. | |
Requests/sec: 76.5321 | |
Status code distribution: | |
[200] 1000 responses |
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
lessc bootstrap.less --clean-css="--s1 --advanced --compatibility=ie8" > ~/Projects/textrocket/public/css/lib/ |
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
# BruteForceKilla | |
# | |
# A Rack middleware to limit requests by ip address, coded for fun as my first | |
# middleware, thanks http://coderack.org for giving me a reason :) | |
# | |
# For production use, one would want to make a memcache or redis tracker. | |
# | |
# options: | |
# | |
# :tracker => Class name of the tracker to use (default Memory (all there is for now!)) |
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
Cursor.prototype.streamRecords = function(callback) { | |
var | |
self = this, | |
stream = new process.EventEmitter(), | |
recordLimitValue = this.limitValue || 0, | |
emittedRecordCount = 0, | |
queryCommand = this.generateQueryCommand(); | |
// see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol | |
queryCommand.numberToReturn = 500; |
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
Last login: Fri Aug 13 17:17:35 on ttys003 | |
troy:~ $ history | awk '{print $2}' | sort | uniq -c | sort -rn | head | |
173 node | |
89 git | |
36 cd | |
25 ls | |
20 ./script/server | |
15 sshebara | |
14 sc | |
12 ssh |
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
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | |
def ensure_search_path! | |
return true if existing_path = Thread.current[:search_path] and @schema_search_path == Thread.current[:search_path] | |
if existing_path | |
@schema_search_path = Thread.current[:search_path] = existing_path | |
else | |
puts "WARNING::SETTING SEARCH_PATH TO SUB1,PUBLIC CUZ Thread.current[:search_path] is nil" | |
@schema_search_path = Thread.current[:search_path]='sub1,public' | |
end |
OlderNewer