Skip to content

Instantly share code, notes, and snippets.

@jgthms
jgthms / download.rb
Created January 2, 2016 19:11
IMDB "Who done it"
#!/usr/bin/env ruby
# https://www.reddit.com/r/movies/comments/1ebi5y/decent_who_done_it_films/
require 'json'
require 'open-uri'
@films=[]
def get_film(id)
json = JSON.parse(open('http://www.omdbapi.com/?i='+id).read())
@jgthms
jgthms / centerify.js
Created July 13, 2015 21:30
jquery centerify
jQuery(document).ready(function ($) {
;(function() {
function Centerify(elem, options) {
var self = this;
self.$elem = $(elem);
self.$sections = self.$elem.children('section');
self.isAnimating = false;
self.bodyAndHeadEl = $('body');
#!/usr/bin/env ruby
#
# Ruby script to download a number of files
# from individual URLs via HTTP/HTTPS/FTP
# specified in an external file.
#
# Author: Tobias Preuss
# Revision: 2013-04-18 16:26 +0100 UTC
# License: Creative Commons Attribution-ShareAlike 3.0 Unported
@jgthms
jgthms / monokai-extended-colors.html
Created May 20, 2015 09:46
Monokai Extended Colors
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Monokai Extended Colors</title>
<style type="text/css">
body{ font-family: monospace; font-size: 12px; line-height: 20px; min-width: 480px;}
span,strong,em{ display: inline-block; vertical-align: top;}
span{ text-align: right; width: 240px;}
strong{ height: 20px; width: 20px;}
@jgthms
jgthms / buttons.scss
Created April 24, 2015 14:15
SCSS HSB buttons
@function hsb($h-hsb, $s-hsb, $b-hsb, $a: 1) {
@if $b-hsb == 0 {
@return hsla(0, 0, 0, $a)
} @else {
$l-hsl: ($b-hsb/2) * (2 - ($s-hsb/100));
$s-hsl: ($b-hsb * $s-hsb) / if($l-hsl < 50, $l-hsl * 2, 200 - $l-hsl * 2);
@return hsla($h-hsb, $s-hsl, $l-hsl, $a);
}
}
@jgthms
jgthms / gist:5173ea9aa2e19de0c89d
Created February 20, 2015 12:25
iOS Switch with HTML input range
/* Tricky stuff */
.range{ height: 30px; position: relative; width: 50px;}
.range input[type=range] {
-webkit-appearance: none;
outline: none;
width: 100%;
}
.range input[type=range]::-webkit-slider-thumb {
@jgthms
jgthms / gist:7004969
Created October 16, 2013 09:16
Weird Jekyll bug. A paragraph starts with the following sentence: "I bought my first Mac two years ago: a brand new (and relatively expensive) 27 inch iMac. ". It triggers the following error. If I delete the sentence, the error disappears.
/gems/maruku-0.6.1/lib/maruku/string_utils.rb:71:in `normalize_key_and_value': undefined method `strip' for nil:NilClass (NoMethodError)