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
private String descriptionVariable(final String text){ | |
if(isFeatured()){ | |
return "<b>" + text + "</b>"; | |
}else{ | |
return "<b><font color='#FD93B1'>" + text + "</font></b>"; | |
} | |
} | |
private Map<String, String> buildDescriptionContext(final JSONObject descriptionHash) throws JSONException, ParseException{ | |
Map<String, String> context = new HashMap<String, String>(); |
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 "compile and run the site" | |
task :default do | |
pids = [ | |
spawn("jekyll serve -w"), # put `auto: true` in your _config.yml | |
spawn("scss --watch css"), | |
spawn("coffee -b -w -o js -c coffee/*.coffee") | |
] | |
trap "INT" do | |
Process.kill "INT", *pids |
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
'.editor:not(.mini)': | |
'ctrl-shift-down': 'rails-rspec:toggle-spec-file' | |
'cmd-ctrl->': 'editor:add-selection-below' | |
'.editor': | |
'alt-cmd-r': 'rails-rspec:toggle-spec-file' | |
'cmd-shift-R': 'rspec:run-for-line' | |
'cmd-shift-T': 'rspec:run' | |
'body': |
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 Jekyll | |
class MarkdownTag < Liquid::Tag | |
def initialize(tag_name, text, tokens) | |
super | |
@text = text.strip | |
end | |
def html_renderer(config) | |
@html_renderer ||= Jekyll::Converters::Markdown.new(config) | |
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
# As requested on https://twitter.com/bcardarella/status/486885890837725184 | |
# | |
# Send a sad brazilian everytime someone says fail. Images from http://sadbrazilians.tumblr.com/ | |
# | |
# Thanks to Kimono Labs for giving me the JSON to get the images | |
# | |
# | |
images = [ | |
"http://33.media.tumblr.com/75ad65b40e42b9bb0a487d29467e84f3/tumblr_n8f721uO1M1tga27vo1_1280.jpg", | |
"http://37.media.tumblr.com/6892659fd667d73d9fc395d3b95cff36/tumblr_n8f5ep7d051tga27vo1_1280.jpg", |
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
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <sstream> | |
#include <fstream> | |
#include <cassert> | |
#include <cstdlib> | |
#include <cstring> | |
#include <climits> | |
#include <cctype> |
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
using namespace std; | |
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <sstream> | |
#include <fstream> | |
#include <cassert> | |
#include <climits> | |
#include <cstdlib> | |
#include <cstring> |
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
# SQLite version 3.x | |
# gem install sqlite3 | |
# | |
# Ensure the SQLite 3 gem is defined in your Gemfile | |
# gem 'sqlite3' | |
# | |
default: &default | |
adapter: sqlite3 | |
pool: 5 | |
timeout: 5000 |
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
def office_hours? | |
Time.use_zone('Pacific Time (US & Canada)') do | |
# window = Time.zone.parse("2014-04-30") | |
now = Time.zone.now | |
start, finish = Time.zone.parse('9:30'), Time.zone.parse('16:30') | |
now.between?(start, finish) # && now.yday == window.yday | |
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
# http://stdout.heyzap.com/2013/04/08/surfacing-interesting-content/ | |
class PopularStream | |
attr_reader :name, :epoch, :max_items | |
# 2.5 * half_life (in days) years from now | |
DEFAULT_EPOC = Date.new(2017, 4, 27).to_time.to_i | |
HALF_LIFE = 1.day.to_i | |
def self.redis | |
RedisConfig.client(:trending_stuff) |
OlderNewer