Skip to content

Instantly share code, notes, and snippets.

View ptbrowne's full-sized avatar

Patrick Browne ptbrowne

View GitHub Profile
@ptbrowne
ptbrowne / README.md
Last active August 29, 2015 14:13
Toggle on/off Bluetooth from Spotlight

Easy toggle on, toggle off bluetooth

Thanks to blueutil, it is possible to toggle Bluetooth from Spotlight, you just have to put to download blueutil and put it in one of the directory of your $PATH, then put those two scripts somewhere.

blueutil: http://www.frederikseiffert.de/blueutil/

@ptbrowne
ptbrowne / reorder-define.js
Last active August 29, 2015 14:14
Reorder define
#! /usr/bin/env node
/*
This script is used to enforce a convention on the order
of the imports in a project that use requirejs
It will transform define calls dependency order according
to a priority.
Example:
@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 / iphone.svg
Created August 26, 2015 13:43
iphone path
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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.