❤️🔥
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
# coding: utf-8 | |
require 'rubygems' | |
require 'hpricot' | |
require 'fileutils' | |
require 'safe_yaml' | |
require 'time' | |
module JekyllImport | |
# This importer takes a wordpress.xml file, which can be exported from your |
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
declare var MithrilQuery: (...options: any[]) => MithrilQueryInstance | |
interface KeyEventOptions { | |
target?: any | |
value?: any | |
altKey?: boolean | |
shiftKey?: boolean | |
ctrlKey?: boolean | |
silent?: boolean | |
} |
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 | |
# Download imgur.com galleries easily | |
# | |
# Requirements: | |
# gem install nokogiri | |
# | |
# Usage: | |
# ruby imgur.rb [url of gallery] [directory to download into] [namespace for files] | |
# |
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
• What does the app do? | |
• How to start a timer? | |
• How to stop a timer? | |
• How does idle time work? | |
• How does summary bar/time summary work? | |
• How to change preferences? | |
• Where do I get it? | |
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 | |
# Get an API key from https://developer.forecast.io/ | |
# | |
# Outputs something like this: | |
# | |
# Clear, 65°F | |
# Moderate chance of rain until tonight | |
FORECAST_IO_API_KEY = "YOUR KEY GOES HERE" |
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
Capybara.add_selector :record do | |
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) } | |
match { |record| record.is_a?(ActiveRecord::Base) } | |
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
# Accepts arguments like: | |
# meta_tag :warning, "HC SVNT DRACONES" | |
# or | |
# meta_tag charset: "utf-8" | |
def meta_tag *options | |
if (options.select {|o| o.is_a?(String) || o.is_a?(Symbol) }.count == options.count) && (options.count == 2) | |
tag :meta, name: options.first, content: options.last | |
else | |
tag :meta, *options | |
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
module ApplicationHelper | |
def content_for_or_pjax(name, &block) | |
request.headers['X-PJAX'] ? capture(&block) : content_for(name, &block) | |
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
set :shared_children, shared_children << 'tmp/sockets' | |
namespace :deploy do | |
desc "Start the application" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false | |
end | |
desc "Stop the application" | |
task :stop, :roles => :app, :except => { :no_release => true } do |
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
# http://ruby-snippets.heroku.com/string/levenshtein-distance | |
class String | |
def levenshtein(other, ins=2, del=2, sub=1) | |
# ins, del, sub are weighted costs | |
return nil if self.nil? | |
return nil if other.nil? | |
dm = [] # distance matrix |
NewerOlder