Skip to content

Instantly share code, notes, and snippets.

🤘
Learning Elixir, Discovering Phoenix

Anders Ytterström madr

🤘
Learning Elixir, Discovering Phoenix
Block or report user

Report or block madr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@madr
madr / gist:1337116
Created Nov 3, 2011
Tackle Outlook 2011 and utf-8 decoded emails
View gist:1337116
<?php
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
// mail( ... )
@madr
madr / gist:1423656
Created Dec 2, 2011
Rake target to generate favicons and apple touch icons
View gist:1423656
# example use:
# rake favicons["../img/origin.png"]
#
# Output:
# ./apple-touch-icon-114x114-precomposed.png
# ./apple-touch-icon-114x114.png
# ./apple-touch-icon-57x57-precomposed.png
# ./apple-touch-icon-57x57.png
# ./apple-touch-icon-72x72-precomposed.png
# ./apple-touch-icon-72x72.png
@madr
madr / gist:1808914
Created Feb 12, 2012
Valign=middle without tables, IE6+ compatible
View gist:1808914
/* @group valignfix */
/* ***************************************
valignfix, by Anders Ytterström @ madr.se
**************************************** */
/*
HTML fixture:
.valign
%div
%div
%h1
@madr
madr / gist:1808920
Created Feb 12, 2012
Unobtrusive Anobii badge
View gist:1808920
var BPs = {};
var AnobiiBadge = (function(){
var BADGE_URL = 'http://widgets.anobii.com/badge_result?settingId=4dd4b3916a743731';
var bodyElm = document.getElementsByTagName('body')[0];
return {
init: function(){
var script = document.createElement('script');
script.src = BADGE_URL;
script.type = 'text/javascript';
bodyElm.appendChild(script);
@madr
madr / gist:1809315
Created Feb 12, 2012
Weekly links to Posterous
View gist:1809315
#!/usr/bin/env ruby
require 'net/https'
require "rexml/document"
require "date"
require 'net/smtp'
# delicious
@username = "YOU"
@password = "secr3t"
@madr
madr / gist:1809354
Created Feb 12, 2012
Weekly links to Posterous, simplified
View gist:1809354
#!/usr/bin/env ruby
require 'net/https'
require "rexml/document"
require "date"
require 'net/smtp'
# delicious
@username = "YOU"
@password = "secr3t"
@madr
madr / gist:1931862
Created Feb 28, 2012
Basic front controller for single page applications
View gist:1931862
/*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, curly:true, browser:true, indent:2, maxerr:50 */
/*!
front.js
(c) 2011 Anders Ytterström
front.js may be freely distributed under the MIT license.
TODO: pushState support
*/
/*
@madr
madr / gist:1931955
Created Feb 28, 2012
Click listener and delegator
View gist:1931955
/*!
light-weight click listener, v 1.0
Copyright (c) 2010 by madr <http://madr.se>
Licensed under the MIT license: http://en.wikipedia.org/wiki/MIT_License
*/
/*
Usage:
Alter the below snippet for your needs and put the modified snippet in a js-file or a <script> and add it to your document. If your webapp depends on libraries or other resources to load, you better keep that in mind.
*/
(function(document, undefined) {
@madr
madr / gist:1931992
Created Feb 28, 2012
Misc JavaScript Helpers
View gist:1931992
function adate(daysFromNow) {
var date, datestr, mm, dd;
datestr = new Date().getTime();
if (!!daysFromNow) {
datestr += (1000 * 60 * 60 * 24 * daysFromNow);
}
date = new Date(datestr);
mm = date.getMonth() + '';
if (mm.length == 1) {
mm = '0' + mm;
@madr
madr / gist:1932023
Created Feb 28, 2012
Useful sass mixins
View gist:1932023
/* vertical ruler using pseudo-elements */
@mixin columnseparator {
@extend .relative;
&:before {
content: '';
position: absolute;
top: 0;
width: 3px;
background: #eee;
You can’t perform that action at this time.