This file contains hidden or 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
{ | |
"name": "status-stats", | |
"main": "./lib/status-stats", | |
"activationCommands": ["status-stats:toggle"], | |
"version": "0.1.0", | |
"private": false, | |
"description": "A derivative of @segphault's status-wordcount. Displays wordcount, grade level, and Flesh Kincaid scores, to help you write for your audience.", | |
"repository": "https://github.com/jbrains/status-stats", | |
"license": "MIT", | |
"engines": { |
This file contains hidden or 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::Matchers.define :eventually_redirect_to do | target_url | | |
def collect_redirect_urls_from(url) | |
redirect_urls = [] | |
response = RestClient.get(url) do | response, request, result, &block | | |
redirect_urls.push(response.headers[:location]) if response.code == 301 | |
response.return!(request, result, &block) | |
end | |
redirect_urls | |
end |
This file contains hidden or 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
#!/bin/sh | |
# Improved safety by not checking out directly into document root | |
pushd /home/jbrains | |
SCRATCH="$(date +%N)" | |
TARGET="/home/jbrains/domains/jbrains.ca/web/wordpress-jbrains.ca" | |
# Backup | |
tar cf "wordpress-jbrains.ca.$SCRATCH.tar" $TARGET | |
# Clone, then copy | |
mkdir $SCRATCH | |
pushd $SCRATCH |
This file contains hidden or 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
a.comment-link { | |
/* Superimposed image */ | |
$icon-comment-height: 10px; /* Must match the size of the graphic */ | |
$icon-comment-width: 10px; /* Must match the size of the graphic */ | |
background: $salmon url(../images/comment.gif) no-repeat $icon-comment-height $icon-comment-width; | |
color: $salmon; | |
&:hover { | |
background: $dark-salmon url(../images/comment.gif) no-repeat $icon-comment-height $icon-comment-width; |
This file contains hidden or 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 "sequel" | |
# Use the module to avoid naming collisions with other specs. | |
module LearnSequelModelSpec | |
describe "Person Model" do | |
let(:db) { Sequel.sqlite } | |
before(:each) do |
This file contains hidden or 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
-- Thanks to @kimwallmark for teaching me `maybe` and showing me how a single lookup. | |
-- I had the brilliant idea of using `snd`, even though I dislike the name. :) | |
fizzbuzz :: Integer -> String | |
fizzbuzz n = maybe (show n) snd $ classify n | |
where | |
classify n = find (\(m, _) -> n `mod` m == 0) [(15, "Fizzbuzz"), (5, "Buzz"), (3, "Fizz")] |
This file contains hidden or 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
# SMELL I don't like the name gemfile_lock_file, but I don't know | |
# what else to call it. I want to distinguish it from Gemfile. | |
def extract_gems_from_gemfile_lock_file(contents) | |
gems = [] | |
# Extract all the non-empty lines between and excluding 'specs:' and 'PLATFORMS' | |
contents.each_line do |line| | |
line = line.strip | |
# It takes a few seconds to understand this algorithm, | |
# but I can't yet justify replacing it with a functional | |
# approach. Again, it depends what the reader understands |
This file contains hidden or 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
Dystopia = | |
expands: (world) -> [] | |
lives: (cell) -> false | |
Utopia = | |
expands: (world) -> world | |
lives: (cell) -> true | |
evolve_world = (world, rules=Dystopia) -> | |
rules.expands(world).filter (cell) -> rules.lives(cell) |
This file contains hidden or 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 "rspec" | |
describe "gist_no_css tag" do | |
context "the pieces" do | |
context "rendering code" do | |
# Assume we've already successfully downloaded code | |
example "gist ID, username and filename" | |
example "gist ID and filename" | |
example "gist ID and username" | |
example "gist ID" |
This file contains hidden or 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
public interface GistWithMultipleFiles {} |