Skip to content

Instantly share code, notes, and snippets.

View rudionrails's full-sized avatar

Rudolf Schmidt rudionrails

View GitHub Profile
@rudionrails
rudionrails / proxy.js
Last active August 2, 2019 12:16
Track object changes with a JavaScript proxy
const pick = (keys, object) =>
Object.entries(object).reduce(
(acc, [key, value]) => (keys.includes(key) ? {...acc, [key]: value} : acc),
{},
);
const parse = x => JSON.parse(JSON.stringify(x));
export default function proxy(initialAttrs = {}) {
let current = parse(initialAttrs);
@rudionrails
rudionrails / gist:5706489
Created June 4, 2013 14:46
Convert images (nested) from one folder into another
# encoding: utf-8
require 'benchmark'
files = Dir[ 'originals/**/*.*' ]
converted = []
duplicates = []
errors = []
@rudionrails
rudionrails / gist:4594223
Created January 22, 2013 12:19
PSimple performance comparision for Yell with the standard Ruby logger
require 'rubygems'
require 'benchmark'
require 'logger'
require 'yell'
count = 50000
Dir[ '*.log' ].each { |f| File.unlink f }
yell = Yell.new 'yell.log'
@rudionrails
rudionrails / changelog.rb
Last active October 11, 2015 04:37
Generate changelog from git based on tags
#!/usr/bin/env ruby
#
# This file generates a full changelog from your git history based on your tags.
#
# @example
# ruby changelog.rb
#
# @example Write to file
# ruby changelog.rb > CHANGELOG.md
@rudionrails
rudionrails / seo optimize your page with css
Created July 22, 2009 12:18
SEO optimize your page with CSS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.container {
/* position: relative;
padding-bottom: 160px; */
background-color: orange;
@rudionrails
rudionrails / Static Footer CSS Template
Created February 19, 2009 21:09
An example for a static footer CSS Layout