Skip to content

Instantly share code, notes, and snippets.

View tdegrunt's full-sized avatar

Tom de Grunt tdegrunt

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@tdegrunt
tdegrunt / Default (OSX).sublime-keymap
Created July 8, 2014 14:10
Sublime Text (3) - Cmd-Click Goto definition
[
{
"button": "button1",
"count": 1,
"modifiers": ["super"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
@tdegrunt
tdegrunt / glasshole.sh
Created September 6, 2014 08:17
This script is a response to a comment by Omer Shapira that the presence of Google Glass worn by audience at an ITP graduate exhibition left him feeling understandably uneasy; it was not possible to know whether they were recording, or even streaming what they were recording to a remote service over WiFi. It follows a productive and open-chested…
#!/bin/bash
#
# GLASSHOLE.SH
#
# Find and kick Google Glass devices from your local wireless network. Requires
# 'beep', 'arp-scan', 'aircrack-ng' and a GNU/Linux host. Put on a BeagleBone
# black or Raspberry Pi. Plug in a good USB wireless NIC (like the TL-WN722N)
# and wear it, hide it in your workplace or your exhibition.
#
# Save as glasshole.sh, 'chmod +x glasshole.sh' and exec as follows:
@tdegrunt
tdegrunt / keybase.md
Last active August 29, 2015 14:07
Keybase proof

Keybase proof

I hereby claim:

  • I am tdegrunt on github.
  • I am tdegrunt (https://keybase.io/tdegrunt) on keybase.
  • I have a public key whose fingerprint is 5180 2DB8 F518 577F DD76 B0E7 A426 AF12 D288 D777

To claim this, I am signing this object:

@tdegrunt
tdegrunt / example.go
Created October 30, 2014 09:42
How to remove value from slice
package main
import "fmt"
func main() {
example := []string{"a", "b", "c", "d", "e", "f", "g", "h"}
i := 3
example = example[:i+copy(example[i:], example[i+1:])]
fmt.Printf("example: %+v\n", example)
@tdegrunt
tdegrunt / gist:7207b4e84b2b0075fb5e
Created December 22, 2014 16:21
Use Java 8 with IntelliJ IDEA on Mac OSX
# With JDK 8 installed:
plutil -replace JVMOptions.JVMVersion -string 1.8.\* /Applications/IntelliJ IDEA 14.app/Contents/Info.plist
module FullErrorMessages
extend ActiveSupport::Concern
# includes errors on this model as well as any nested models
def all_error_messages
messages = self.errors.messages.dup
messages.each do |column, errors|
if self.respond_to?(:"#{column}_attributes=") && (resource = self.send(column))
messages[column] = resource.errors.messages
end
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@tdegrunt
tdegrunt / convert.sh
Created April 8, 2015 13:52
Easily rip all dvd titles to separate files
#!/bin/bash
for i in `seq -w 1 8`;
do
HandbrakeCLI --no-dvdnav --input DVD7.iso --title $i --output ~/Desktop/BB/S7/S07E$i.mkv
done
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}