Skip to content

Instantly share code, notes, and snippets.

@abuisman
abuisman / keybase.md
Created October 24, 2017 09:09
keybase.md

Keybase proof

I hereby claim:

  • I am abuisman on github.
  • I am abuisman (https://keybase.io/abuisman) on keybase.
  • I have a public key whose fingerprint is D8AB A4EB 22A5 21EA 7D9B C682 369F 08D5 A1B0 0352

To claim this, I am signing this object:

@abuisman
abuisman / dumpert cinema
Created March 11, 2014 17:55
Dumpert Cinema Bookmarklet
javascript:(function(){var s0=document.createElement('script');s0.setAttribute('src','http://jquery.com/src/jquery-latest.js');document.getElementsByTagName('body')[0].appendChild(s0);item = jQuery('#item');item_wrapper%20=%20jQuery('#item1_wrapper');playarea%20=%20jQuery('#playerarea%20#item,%20#fotostream%20.foto');if(window.dumpertCinema%20===%20undefined%20||%20window.dumpertCinema%20===%20false){%20if(window.dumpertCinema%20===%20undefined){window.dumpertCinemaVars%20=%20{item:%20{height:%20item.css('height'),float:%20item.css('float')},item_wrapper:%20{width:%20item_wrapper.css('width'),height:%20item_wrapper.css('height')},playarea:%20{width:%20playarea.css('width')}};}item.css('height',%20'auto').css('float',%20'none');item_wrapper.css('width',%20'100%').css('height',%20'500px');playarea.css('width',%20'100%');window.dumpertCinema%20=%20true;}%20else%20{item.css('height',%20window.dumpertCinemaVars.item.height).css('float',%20window.dumpertCinemaVars.item.float);item_wrapper.css('width',%20window.dump
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@abuisman
abuisman / amplify.store.js
Created November 2, 2012 22:33
Amplify store minified.
/*!
* Amplify Store - Persistent Client-Side Storage 1.1.0
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function(a,b){function e(a,e){c.addType(a,function(f,g,h){var i,j,k,l,m=g,n=(new Date).getTime();if(!f){m={},l=[],k=0;try{f=e.length;while(f=e.key(k++))d.test(f)&&(j=JSON.parse(e.getItem(f)),j.expires&&j.expires<=n?l.push(f):m[f.replace(d,"")]=j.data);while(f=l.pop())e.removeItem(f)}catch(o){}return m}f="__amplify__"+f;if(g===b){i=e.getItem(f),j=i?JSON.parse(i):{expires:-1};if(j.expires&&j.expires<=n)e.removeItem(f);else return j.data}else if(g===null)e.removeItem(f);else{j=JSON.stringify({data:g,expires:h.expires?n+h.expires:null});try{e.setItem(f,j)}catch(o){c[a]();try{e.setItem(f,j)}catch(o){throw c.error()}}}return m})}var c=a.store=function(a,b,d,e){var e=c.type;d&&d.type&&d.type in c.types&&(e=d.type);return c.types[e](a,b,d||{})};c.types={},c.type=null,c.addT
@abuisman
abuisman / gist:3706756
Created September 12, 2012 13:54
Some implementation of 'customers who bought this also bought'
// Source: http://www.ubercart.org/contrib/2972
<?php
function RiffTrax_uc_cart_view_form($form) {
drupal_add_css(drupal_get_path('module', 'uc_cart') .'/uc_cart.css');
$output = '<div id="cart-form-products">'
. tapir_get_table('uc_cart_view_table', $form) .'</div>';
if ((
@abuisman
abuisman / gist:2863979
Created June 3, 2012 15:58
Some example of Backbone and AMD for SO question
// file: models/Task.js
define([], function(){
var Task = Backbone.Model.extend({
//do stuff
});
return Task;
});
@abuisman
abuisman / Templater.coffee
Created May 15, 2012 18:15
A modular (AMD) template file loader for for example underscore.js
/*
A modular (AMD) template file loader for for example underscore.js.
You can use the templater to load up html files as a string in order to use them as templates
for your client side javascript templating.
Pay notice to the 'base_path'. Set this to where your templates reside. The path below is
assuming a Rails application.
You could also not use the base path and just pass it in fully every time.
@abuisman
abuisman / typography.sass
Created May 9, 2012 22:15
Mixin for responsive (relative) font-sizes depending on the screen size using media queries.
/*
Mixin for responsive (relative) font-sizes depending on the screen size using media queries.
This is width based, but you can easily adjust it for more complex, or simple, checking.
Set the base as you max size, then I divided everything into tenths of the base.
To use, simply include the mixin, passing it the font-size that you'd want to see at 100%.
This should then scale nicely along in tenths. If you need more detail, just add more elements to the level list.
@abuisman
abuisman / app_concerns_AssetChild.rb
Created December 15, 2011 22:49
Problem with :name of child
module AssetChild
# by defining a module this should allow us to make nice code which adds:
#
# - has_one :assets
# - adds an after_create hook which automaticly builds the asset.
# - at some latter point we can also add after_update - to update the asset it's timestamp.
# - give access to asset attributes such as name => @usecase.name instead of @usecase.asset.name
#
# -> http://weblog.jamisbuck.org/2007/1/17/concerns-in-activerecord