Skip to content

Instantly share code, notes, and snippets.

View ptbrowne's full-sized avatar

Patrick Browne ptbrowne

View GitHub Profile
@ptbrowne
ptbrowne / index.html
Created February 5, 2015 17:35
Leaflet Path Seeker// source http://jsbin.com/tiyuqejuso
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Leaflet Path Seeker" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
@ptbrowne
ptbrowne / solve-android-support-v4
Created March 13, 2015 23:01
Solve Cordova build problem
This is due because some Android libraries ship with android-support-v4.jar and they will likely be different.
Facebook SDK for android ships with android-support-v4.jar and some Cordova libraries also do.
To solve this problem, remove the files for the directory concerned and simply symlink to the android-support-v4.jar
contained in your android sdk directory.
For example I had
```
[dependency] Found 2 versions of android-support-v4.jar in the dependency list,
@ptbrowne
ptbrowne / sigrestart
Last active August 29, 2015 14:18
sigrestart
#! /bin/bash
# Usage:
# ./sigrestart 11 gulp watch
# Here if by any chance the command `gulp watch` is killed
# via the signal 11 (SIGSEGV), it will be restarted
# Since gulp has the bad habit of dying with SIGSEGV, it is
# very useful
@ptbrowne
ptbrowne / buildingAt.js
Created May 17, 2015 18:51
building at lat lng
#!/usr/bin/env node
// npm install bluebird request xml-parser lodash
// usage: node buildingAt.js 43.699100505623726 7.264087200164794
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
var parse = require('xml-parser');
var _ = require('lodash');
@ptbrowne
ptbrowne / gist:48ff446551af768f11cc
Created June 5, 2015 12:38
guillotine to canvas
var data = $('#sample_picture').guillotine('getData');
var pic = $('#sample_picture').get(0);
var canvas = $('canvas').get(0);
if (!canvas) {
$('body').append('<canvas/>')
canvas = $('canvas').get(0);
}
var src = pic.src;
var newPic = new Image();
@ptbrowne
ptbrowne / magic.py
Last active August 29, 2015 14:26
Magic Class
# -*- coding: utf-8 -*-
class MagicType(type):
def __new__(cls, name, bases, attrs):
if name.startswith('None'):
return None
newattrs = dict(attrs)
@ptbrowne
ptbrowne / arrow.svg
Created September 1, 2015 13:25
arrow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Config

Editeur: sublime text

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get install sublime-text

Custom keybindings

@ptbrowne
ptbrowne / swiper-2.4.3.css
Created September 8, 2015 13:37
swiper 2.4.3
/*
* Swiper - Mobile Touch Slider CSS
* http://www.idangero.us/sliders/swiper
*
* Vladimir Kharlampidi, The iDangero.us
* http://www.idangero.us/
*
* Copyright 2012-2013, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us
@ptbrowne
ptbrowne / gist:1462440
Created December 11, 2011 20:04 — forked from jamescasbon/template.py
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()