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
javascript:(function(){var i=document.querySelector('#comic img'),t=i.getAttribute('title');i.insertAdjacentText('afterEnd',t);})(); |
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
-- initial | |
UPDATE item SET depth = 0 WHERE parent_item_guid IS NULL; | |
-- SQLite3 doesn't support loops, so run this until `select count(*) from item where product_code is null` = 0 | |
INSERT OR REPLACE INTO item(item_guid, user_guid, parent_item_guid, name, depth) | |
SELECT t.item_guid, t.user_guid, t.parent_item_guid, t.name, p.depth + 1 FROM item AS t | |
INNER JOIN item AS p ON (t.parent_item_guid = p.item_guid) | |
WHERE p.depth >= 0 | |
AND NOT p.item_guid IS NULL | |
AND t.depth IS NULL; |
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
# encoding: UTF-8 | |
require 'erb' | |
puts __ENCODING__ | |
puts ERB.new('<%= __ENCODING__ %>').result |
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
var contrast = (function () { | |
var MIN_CONTRAST_RATE_AA = { normal: 4.5, large: 3 }, | |
MIN_CONTRAST_RATE_AAA = { normal: 7, large: 4.5 }, | |
MIN_BRIGHT_DIFF = 125/255, | |
MIN_COLOR_DIFF = 500/255, | |
BRIGHTNESS_COEFS = [0.299, 0.587, 0.114], | |
LUMINANCE_COEFS = [0.2126, 0.7152, 0.0722]; | |
function abs_diff(array, other) { |
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
Gem::Specification.new do |spec| | |
spec.name = 'sass-yuv' | |
spec.version = '0.1.0' | |
spec.platform = Gem::Platform::RUBY | |
spec.author = 'Tobias H. Michaelsen' | |
spec.email = '[email protected]' | |
spec.summary = 'YUV color space in SASS' | |
spec.description = 'A simple extension to SASS that alows you to convert to and from the YUV color space, and adjust brightness.' | |
spec.homepage = 'https://gist.github.com/1694554' | |
spec.license = 'MIT' |
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
module ModelSerializer | |
def self.serialize(object) | |
object.to_json include: nil # don't include any associations - only serialize shallow object | |
end | |
def self.deserialize(json) | |
hash = ActiveSupport::JSON.decode(json) # => { "section": { "id": 42, ... } } | |
model = hash.keys.first.camelize.constantize # => Section | |
attributes = hash.values.first | |
object = model.new |
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 "sass" | |
require "chunky_png" | |
module Sass::Script::Functions | |
# Generates a data-url for a PNG created from the given color. | |
# Can be used to set a alpha-transparent background for IE8< | |
# | |
# @example | |
# background: url(inline-color-image(rgba(102, 54, 32, 0.5))); | |
def inline_color_image(color) |
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
Math.round(0.4999999999999999722444243843710865) == 1 | |
Math.round(0.4999999999999999722444243843710864) == 0 |
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
APP_PATH = File.expand_path('../..', __FILE__) | |
require File.join(APP_PATH, "lib/site") | |
working_directory APP_PATH | |
pid_path = File.join(APP_PATH, "tmp/pids/web.pid") | |
pid pid_path | |
stderr_path File.join(APP_PATH, "log/unicorn-stderr") | |
stdout_path File.join(APP_PATH, "log/unicorn-stdout") |
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 "chunky_png" | |
module Sass::Script::Functions | |
# Generates a data-url for a PNG created from the given color. | |
# Can be used to set a alpha-transparent background for IE8< | |
# | |
# @example | |
# background: url(inline-color-image(rgba(102, 54, 32, 0.5))); | |
def inline_color_image(color) | |
assert_type color, :Color |