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($){ | |
$.fn.textExtents = function(options){ | |
var spans = $('span:visible', this); | |
var heightMax = parseInt($(this).css('max-height')); | |
var widthMax = parseInt($(this).css('max-width')); | |
var fontSize = parseInt($(this).css('font-size')); /* max font size */ | |
do{ | |
var textHeight = 0; | |
var textWidth = 0; | |
$(spans).each(function(){ |
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 'sinatra/base' | |
require 'sinatra/namespace' | |
# You may need multi_json | |
class API < Sinatra::Base | |
# Respond to all errors with JSON | |
error do | |
content_type :json | |
e = env['sinatra.error'] |
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 User extends Spine.Model | |
url: -> | |
'/' + @username | |
collections: -> | |
unless @collection_klass? | |
@collection_klass = _.clone(Collection) | |
@collection_klass.parent = this | |
@collection_klass |
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
# You'll need to add 'rack-rewrite' to your Gemfile. | |
require 'rack/rewrite' | |
require File.expand_path("../config/boot.rb", __FILE__) | |
# lazy load the application, instantiating routes. | |
application = Padrino.application | |
# Determine which routes NOT to redirect to your root resource. | |
reserved_routes = YourProject::App.routes.map{|r| | |
r.path_for_generation.scan /[a-zA-Z0-9]+/i |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// lmutracker.mm -- Provides lux measurement using MacBook Ambient Light Sensor | |
// | |
// clang -o lmutracker lmutracker.mm -framework IOKit -framework CoreFoundation | |
// | |
// Adaptation of code originally posted at https://bugzilla.mozilla.org/show_bug.cgi?id=793728 | |
// by Reuben Morais. Modified by Ken Keiter <ken@kenkeiter.com> to output a single *lux* value | |
// and exit, rather than repeating measurements on the sensor's arbitrary scale. | |
#include <mach/mach.h> | |
#include <math.h> |
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
.js-moments-tab { | |
display: none !important; | |
} | |
.wtf-module { | |
display: none !important; | |
} | |
.LiveVideoHomePageModuleContainer { | |
display: none !important; |
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 Proc | |
def call_with_vars(vars, *args) | |
Struct.new(*vars.keys).new(*vars.values).instance_exec(*args, &self) | |
end | |
end | |
module Touchy | |
class GuardError < Exception; end | |
class GuardSignatureError < GuardError; 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
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
g++ \ | |
make \ | |
file \ | |
curl \ | |
ca-certificates \ | |
python2.7 \ | |
git \ |
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
import os | |
import markdown | |
from markdown_include.include import MarkdownInclude | |
import weasyprint | |
from mako.template import Template | |
HTML_BOILERPLATE_TEMPLATE = """ | |
<html> | |
<head> | |
<style>{css}</style> |