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
var fs = require('fs'), | |
path = './bower_components/fontawesome/scss/_icons.scss', | |
regex = /\.#{\$fa-css-prefix}([-|\w]+):before/g, | |
match, | |
data; | |
ENV.APP.awesomeness = []; | |
data = fs.readFileSync(path, 'utf8'); | |
while(match = regex.exec(data)) { |
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
RSpec.configure do |c| | |
if c.respond_to?(:default_color=) | |
c.failure_color = :green | |
c.success_color = :green | |
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
Customer.joins(subscriptions: :product).group(:email).select('GROUP_CONCAT(DISTINCT subscriptions.state SEPARATOR ":::") AS states, GROUP_CONCAT(DISTINCT products.name SEPARATOR ":::") AS product_names, first_name, last_name').last.states |
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 Base | |
DEFAULT_PROC = -> () {} | |
def initialize(api_key, connection_class = External::Service, builder = -> (klass, key) { klass.new(key) }) | |
@api_key = api_key | |
@builder = builder | |
@connection_class = connection_class | |
end | |
def execute(&block) |
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
function clogs() { | |
if [[ -d log ]]; then | |
echo 'cleaning logs' | |
: > log/*.log | |
else | |
echo 'logs dir not found' | |
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
# The wrong way to make a class level method private | |
class Foo | |
def self.bar | |
p "bar" | |
end | |
private | |
def self.baz |
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
desc 'creates a new post prefixed with the current date' | |
task :post, :name, :title, :categories do |task, args| | |
File.open(File.join('_posts', Time.now.strftime("%Y-%m-%d-#{args[:name].split(' ').join('-')}.markdown")), 'w') do |file| | |
file << <<-DOC | |
--- | |
layout: post | |
title: "#{args[:title].downcase}" | |
date: #{Time.now.strftime("%Y-%m-%d-%H:%M:%S")} | |
categories: #{args[:categories].downcase} | |
--- |
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 'active_support/core_ext/string/inquiry.rb' | |
def speak_like_a(val) | |
is = val.inquiry | |
if is.chicken? | |
puts "bagaaawk" | |
elsif is.pig? | |
puts "oink" | |
else | |
puts "sorry don't know what tongue that speak in" |
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 Refinement | |
refine String do | |
def reverse | |
self[0..1] | |
end | |
end | |
end | |
class Boom |
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 Test | |
# :( wish this worked | |
private def self.bar | |
puts "self bar" | |
end | |
# would be nice to not have to do this | |
class << self | |
private def nook | |
puts "self nook" |