Skip to content

Instantly share code, notes, and snippets.

Greg Leuch gleuch

Block or report user

Report or block gleuch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gleuch
gleuch / gist:2475825
Created Apr 24, 2012
Javascript documentfragment to string (w/ text selection)
View gist:2475825
// selection range
var range = window.getSelection().getRangeAt(0);
// plain text of selected range (if you want it w/o html)
var text = window.getSelection();
// document fragment with html for selection
var fragment = range.cloneContents();
// make new element, insert document fragment, then get innerHTML!
View keybase.md

Keybase proof

I hereby claim:

  • I am gleuch on github.
  • I am gleuch (https://keybase.io/gleuch) on keybase.
  • I have a public key whose fingerprint is C946 8E6E EAA6 243D C39E 2780 533B BC98 03C5 8CAC

To claim this, I am signing this object:

@gleuch
gleuch / macchange.sh
Last active Mar 28, 2017
Alter your MAC address when connecting to WiFi networks. For OS X (Macbooks, etc.)
View macchange.sh
#
# MACchange
# v1.1
#
# Alter your MAC address when connecting to WiFi networks.
#
# -----------------------------------------------------------------------------
#
# - Works great for places that have 1 hour time limits on wifi access, as
# tracked by mac address
View example.rive
! version = 2.0
+ hello bot
- Hello, human!
View example.aiml.xml
<?xml version="1.0" encoding="UTF-8"?>
<aiml>
<category>
<pattern>GOODBYE <set name="clientName">*</set></pattern>
<template>
Goodbye <get name="clientName" />.
</template>
</category>
<category>
<pattern>HELLO <set name="clientName">*</set></pattern>
@gleuch
gleuch / gist:7721755
Created Nov 30, 2013
sample for random image replacement on page
View gist:7721755
// Really basic shuffle function for array, via http://stackoverflow.com/a/6274381
function shuffle(o){for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o;};
// Your replacement images
var replaceImages = array('image1.jpg', 'image2.jpg'); // add more here
var replaceIndex = 0; // stores which image in your array you are on
// Randomize the array so it is not always the same each time
replaceImages = shuffle(replaceImages);
View gist:5486282
1c1
< WHEREAS, DreamHost Web Hosting is an information provider connected to the Internet DreamHost Web Hosting offers storage and transfer services over the Internet through access to its Web Server;
---
> WHEREAS, ZippyKid WordPress Hosting is an information provider connected to the Internet ZippyKid WordPress Hosting offers storage and transfer services over the Internet through access to its Web Server;
3c3
< WHEREAS, Customer seeks to utilize DreamHost Web Hosting’s server for its own purposes;
---
> WHEREAS, Customer seeks to utilize ZippyKid WordPress Hosting’s server for its own purposes;
5c5
< WHEREAS, the parties acknowledge that the Internet is neither owned nor controlled by any one entity; therefore, DreamHost Web Hosting can make no guarantee that any given reader shall be able to access DreamHost Web Hosting’s server at any given time.
View lotterycheck.rb
# 30 mar 2012
final = {:draw => [46, 23, 38, 4, 2], :mega => 23}
scores = [
{:draw => [0,0,0,0,0], :mega => 0},
{:draw => [0,0,0,0,0], :mega => 0},
{:draw => [0,0,0,0,0], :mega => 0},
{:draw => [0,0,0,0,0], :mega => 0},
@gleuch
gleuch / gist:862497
Created Mar 9, 2011
Open Chrome with iPhone 4 User Agent
View gist:862497
open /Applications/Google\ Chrome.app/ --args -user-agent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"
View gist:830432
#!/bin/sh
#
# branch [branchname]
#
# Create a new local AND remote git branch
# Setup local branch to use remote tracking
#
branch=$1
if [ -z $branch ]; then
You can’t perform that action at this time.