Skip to content

Instantly share code, notes, and snippets.

View DrummerHead's full-sized avatar
💭
Eternally Elated

DrummerHead DrummerHead

💭
Eternally Elated
View GitHub Profile
@DrummerHead
DrummerHead / map_processing.rb
Created June 8, 2013 05:13
Ruby implementation of Processing's map function
# Ruby implementation of Processing's map function
# http://processing.org/reference/map_.html
def map(value, v_min, v_max, d_min, d_max) # v for value, d for desired
v_value = value.to_f # so it returns float
v_range = v_max - v_min
d_range = d_max - d_min
d_value = (v_value - v_min) * d_range / v_range + d_min
end
@DrummerHead
DrummerHead / reddit_comments_order.rb
Last active December 18, 2015 05:49
Get a list of your last 1000 reddit comments, ordered by score. Useful for storage and to actually order your posts by score, since reddit can't currently do so. Put your username as argument (or just wait for it to be asked) and get a lovely html file!
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
# Ask for name and check if it exists
args = ARGF.argv
if args.empty?
puts "Type the name of the reddit user:"
@DrummerHead
DrummerHead / quo.rb
Created February 24, 2014 02:06
My first Quine
c=["p", "r", "i", "n", "t", "\"", "c", "=", "\"", ";", "p", " ", "c", ";", "c", ".", "e", "a", "c", "h", "{", "|", "c", "|", "p", "r", "i", "n", "t", " ", "c", "}"]
print"c=";p c;c.each{|c|print c}
<html>
<head>
<meta charset="utf-8">
<title>Movies sicodelia</title>
<meta name="description" content="Magia? Interminable!">
<meta name="viewport" content="width=device-width">
<meta name="author" content="DrummerHead">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="main.css">
</head>
/* Moviessss yey! */
/* vars
* ========================== */
/* end vars */
/* Mixins
* ========================== */
.clearfix:before, dl:before, #movies:before, .rect s:before, .clearfix:after, dl:after, #movies:after, .rect s:after {
content: '';
display: table;
// http://www.imdb.com/chart/top
//
$('.lister-list tr').each(function(i, el){
var _this = $(this);
var yearInt = parseInt(_this.find('.secondaryInfo').text().replace(/[\(\)]/g, ''), 10);
if(yearInt <= 1990){
_this.remove();
}
});
#!/usr/bin/env ruby
files = [
'variables',
'mixins',
'font-face',
'baseline',
'persistent',
'responsive',
'print',
@DrummerHead
DrummerHead / gist:4982b32bd6d0fbd4ba76
Created March 23, 2015 18:31
combine two staticly generated sites
#!/bin/bash
cd emulation
rm -rf *
cd ..
cd web
grunt build
cp -r public/ ../emulation/
cd ../blog
rake generate
<!doctype html>
<html>
<head>
<title>MDL basic html scaffold</title>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link rel='stylesheet' href='https://storage.googleapis.com/code.getmdl.io/1.0.5/material.indigo-pink.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700'>
<link rel='stylesheet' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
<link rel='stylesheet' href='css/main.css'>
@DrummerHead
DrummerHead / frontend-programming-design-resources.md
Last active March 28, 2024 20:34
List of Front-end, programming & design resources