Skip to content

Instantly share code, notes, and snippets.

@pixeldock
pixeldock / ViewController.swift
Last active March 11, 2018 20:33
Generic UIViewController with horizontal UIScrollView that was created programatically with Auto Layout using SnapKit
//
// ViewController.swift
// HorizontalScrollView
//
// Created by Jörn Schoppe on 13.04.16.
// Copyright © 2016 pixeldock. All rights reserved.
//
import UIKit
import SnapKit
@jradavenport
jradavenport / world_pop.py
Last active May 30, 2016 08:51
Spinning World Population Density
# Resulting video from this code can be seen here:
# http://www.ifweassume.com/2015/02/world-population-density.html
# or
# https://vimeo.com/120308257
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import os
@petehamilton
petehamilton / plot-data.r
Last active February 8, 2018 17:43
Plot GoCardless Customers by Location
# Execute with: R --slave -f draw.r
library(maps)
library(mapdata)
library(foreach)
library(doParallel)
# Use the GoCardless font
par(family="Gotham-Book")
@adactio
adactio / postforms.js
Created March 2, 2014 23:42
Show a progress bar when a form is submitted (and prevent more than one submission per document).
/*
Show a progress element for any form submission via POST.
Prevent the form element from being submitted twice.
*/
(function (win, doc) {
'use strict';
if (!doc.querySelectorAll || !win.addEventListener) {
// doesn't cut the mustard.
return;
}
@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@craigspaeth
craigspaeth / gist:8088618
Last active January 1, 2016 03:59
Sharing data between Browserify modules
// I have a Backbone model where I need to use the same API_URL variable
// on the server and client. With Sharify it looks something like this...
// app.js
sharify.data = { API_URL: 'http://artsy.net/api/v1' };
app.use(sharify);
// models/artwork.js
var Backbone = require('backbone'),
API_URL = require('sharify').data.API_URL;
@elmer-garduno
elmer-garduno / RMQReceiver.scala
Created September 6, 2013 03:01
RabbitMQ Actor with Receiver
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@tfoldi
tfoldi / tableau.rb
Created April 24, 2013 07:56
This ruby class can logon and invoke REST API URLs in Tableau server. Authentication is done by using RSA crpyto stuff.
require 'httpclient'
module TableauLDAPSync
class Tableau
def initialize(server_url)
proxy = ENV['HTTP_PROXY']
@http_client = HTTPClient.new(proxy)
@http_client.set_cookie_store("cookie.dat")
@ericdwhite
ericdwhite / Makefile
Last active April 17, 2016 04:11
Example using CURL to access https://www.newsblur.com/api
#
# To use this Makefile:
# 1. Change USER, PASSWORD
#
# 2. Login
# $ make login
# This creates a session file holding an API cookie (tmp/session.newsblur)
#
# 3. Downloads your feeds
# $ make feeds
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#