Skip to content

Instantly share code, notes, and snippets.

View nippysaurus's full-sized avatar

Michael Dawson nippysaurus

View GitHub Profile
import sys
import csv
# import time
import re
from typing import Iterator
from datetime import datetime, timezone, timedelta
# Mango Baby format
// This is where the individual donation data will live.
// This does not have a state or error key because this is not where the loading happens.
donations: {
1: {
// When an action is performed which involves an api call we keep a track of the request here.
// This allows us to show that the action is in progress. And if the user navigates away from the current page then back, it will still be in progress.
actions: {
refunding: {
request: <request object>,
errorMessage: ""
rsync -av --delete-after --safe-links source/ dest
@nippysaurus
nippysaurus / Responsive Javascript
Last active December 14, 2015 18:39
A snippet I recently used to re-size an element which could not be styled with a stylesheet.
var responsive = function(configs) {
var current_config = null;
var $window = $(window);
$window.resize(function(event) {
var width = $window.width();
$(configs).each(function() {
@nippysaurus
nippysaurus / gist:4560589
Created January 17, 2013 22:48
Just a little helper to calculate the time saved by using threads in my code.
times = []
def Timed (times)
Thread.new {
start = Time.now
yield
times.push(Time.now - start)
}
end
(function($){
window.User = Backbone.Model.extend({
urlRoot: 'users'
});
window.UserView = Backbone.View.extend({
tagName: 'li',
initialize: function(){
_.bindAll(this, 'render', 'unrender', 'remove');
//NSString *path = [[self bundle] pathForResource:@"dino" ofType:@"tiff"];
NSString *path = [[self bundle] pathForResource:@"a" ofType:@"gif"];
NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
@nippysaurus
nippysaurus / PassingBlocks.m
Created December 9, 2010 02:10
example of accepting block as parameter
// from:
// http://www.informit.com/blogs/blog.aspx?uk=Ask-Big-Nerd-Ranch-Blocks-in-Objective-C#footnote1
// example accepting block as parameter
- (NSArray *)mapUsingBlock:(id (^)(id obj))block
{
NSMutableArray *output = [NSMutableArray array];
for (id obj in self)
[output addObject:block(obj)];