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
View Jimmie special.md

Jimmie special 29:-: En burk Kung Gustavs sardiner, serveras med en påse chips (60g) och en lättöl

View rövardansen.js
function encrypt (str) {
return str.replace(/([^aeiouöäå01-9])/gi, (c) => { return `${c}o${c}`; });
}
function decrypt (str) {
return str.replace(/([^aeiouöäå01-9])o([^aeiouöäå01-9])/gi, (origin, first, last) => {
return (first == last)? first: origin;
});
}
@madr
madr / gist:2965201
Created Jun 21, 2012
Upload static file dir recursively to Amazon S3 using python
View gist:2965201
from os import listdir
from os.path import isdir
from simples3 import S3Bucket # pip install simples3
root = "../static"
exclude = [".DS_Store"]
A = "access key"
B = "secret key"
bucket = "guidenext"
View hijax.js
(function (g) {
"use strict";
var hijax;
hijax = function (method, uri, data, onSuccess, onError) {
var client = new XMLHttpRequest();
if (onError == undefined) {
onError = function (status, response) {
alert('you have been found guilty of being in league with the devil ' +
View gist:cc0e19236c55701fc6e79e8cda75ddc8
## OS X
Installing Radicale on OS X is almost as easy as it is for Linux or *BSD.
OS X comes with Python preinstalled, but not version 3. Go to [python.org](https://www.python.org/downloads/mac-osx/) and download the latest version of Python. Run the installer.
It is also possible to install Python 3 using `brew` by typing `brew install python3` in a Terminal window.
Then launch a Terminal window, and type:
View hijax.js
var hijax = function (method, uri, callback) {
var client = new XMLHttpRequest();
client.open(method, uri, true);
client.onload = function () {
if (client.status >= 200 && request.status < 400) {
callback(client.responseText);
}
};
@madr
madr / site.less
Last active Feb 14, 2016
LESS boilerplate
View site.less
/*csslint box-model: false, box-sizing: false, universal-selector: false */
/*
All projects
should have nice
ASCII ART!
http://patorjk.com/software/taag/
@madr
madr / javascript.js
Last active Jan 21, 2016
String replacement using regular expressions
View javascript.js
var results = 'hi bob123';
results = results.replace(/bob\d+/, 'cooper');
@madr
madr / example-infinitescroll.js
Last active Dec 31, 2015
Primitive scroll guard utility
View example-infinitescroll.js
/*jslint browser: true, indent: 4 */
/*
Example use of ScrollGuard: a simple, unobtrusive lazy loader.
Each time the user scrolled to the bottom of the page:
1. Look if there is content to load (lookForNextPage)
2. If new content, get content using Ajax (getNextPage)
3. Append the new content and do some polish (appencContent)
You can’t perform that action at this time.