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
Verifying my Blockstack ID is secured with the address 15AxSKrwo7Cwnzqa9Zq2T6iB2GpYKVAYDw https://explorer.blockstack.org/address/15AxSKrwo7Cwnzqa9Zq2T6iB2GpYKVAYDw |
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
redis-cli --raw keys 'namespace:*'|xargs -L1 redis-cli del |
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 RSpec | |
module Core | |
module MemoizedHelpers | |
module ClassMethods | |
# Usage: ways of defining config getters | |
# Before: | |
# let!(:user_1) { DataSource.get(:user_1) } | |
# let!(:user_2) { DataSource.get(:user_2) } | |
# After: |
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
for i in `seq 10` ; do rspec spec ; [[ ! $? = 0 ]] && break ; done |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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 Util | |
# Create Job class from ENV string | |
def self.create_job_class(name, queue_var) | |
klass = Class.new(ActiveJob::Base) do | |
queue_as ENV.fetch(queue_var, 'default') | |
end | |
create_dynamic_class(name, klass) | |
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
is_weekday = lambda {|day_of_week, time| time.wday == day_of_week}.curry | |
sunday = is_weekday[0] | |
monday = is_weekday[1] | |
tuesday = is_weekday[2] | |
wednesday = is_weekday[3] | |
thursday = is_weekday[4] | |
friday = is_weekday[5] | |
saturday = is_weekday[6] |
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
#Extended this gist https://gist.github.com/knapo/8897592 | |
class ActiveRecord::Base | |
def self.has_many_documents(association_name) | |
class_eval %< | |
def #{association_name} | |
#{association_name.to_s.singularize.classify}.where(#{name.underscore}_id: id) | |
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
#!/usr/bin/env ruby | |
# Please read http://otobrglez.opalab.com for more information about this code. | |
class Book < Struct.new(:title) | |
def words | |
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort | |
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
# DOCKER-VERSION 0.4.8 | |
# am facing issue | |
# https://github.com/dotcloud/docker/issues/1123 | |
FROM ubuntu:12.04 | |
MAINTAINER Deepak Kannan "deepak@codemancers.com" | |
RUN apt-get -y install python-software-properties |