Skip to content

Instantly share code, notes, and snippets.

@Acorn-zz
Acorn-zz / hole.pyw
Created July 12, 2011 23:06
wxpython hole in transparent background attempt
import wx
class Frame(wx.Frame):
def __init__(self):
super(Frame, self).__init__(None)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.SetTransparent(200)
@Acorn-zz
Acorn-zz / GM_XHR.js
Created July 2, 2011 13:32 — forked from monperrus/GM_XHR.js
allows using all Jquery AJAX methods in Greasemonkey
// allows using all Jquery AJAX methods in Greasemonkey
// inspired from http://ryangreenberg.com/archives/2010/03/greasemonkey_jquery.php
// works with JQuery 1.5
// (c) 2011 Martin Monperrus
// (c) 2010 Ryan Greenberg
//
// Usage:
// $.ajax({
// url: '/p/',
// xhr: function(){return new GM_XHR();},
@Acorn-zz
Acorn-zz / gist:1059755
Created July 2, 2011 05:20
Upload image to imgur using YQL
# Takes an image URL and uploads it to imgur.com, calling the callback with the resulting image URL
urlToImgur = (url, callback) ->
upload_url = "http://api.imgur.com/2/upload?url=#{url}"
$.ajax
url: 'http://query.yahooapis.com/v1/public/yql'
dataType: 'jsonp'
data: {
q: "select none from html where url='#{upload_url}'"
diagnostics: true
@Acorn-zz
Acorn-zz / gist:1059155
Created July 1, 2011 18:45
Load jQuery and jQuery UI in bookmarklet
((window, document, requirements, callback) ->
getScript = (url, callback) ->
script = document.createElement('script')
script.src = url
head = document.documentElement.childNodes[0]
done = false
script.onload = script.onreadystatechange = ->
if not done and (not (readyState = @readyState) or readyState == 'loaded' or readyState == 'complete')
done = true
callback()
@Acorn-zz
Acorn-zz / script.coffee
Created May 11, 2011 22:24
Array of rows to array of columns
grid = [
[1,2,3,4]
[5,6,7,8]
[9,0,9,8]
]
grid2 = []
for i in grid[0]
grid2.push []
class List extends Array
constructor: (args...) ->
super args
list = new List(1,2,3,4)
console.log list
@Acorn-zz
Acorn-zz / mazegen.py
Created April 3, 2011 11:02
Generating random maze using disjoint sets
import random
import sys
import numpy
X = 20
Y = 20
# the following creats a two dimensional array
# of indexes. Each cell now has a number, and we can convert co-ordinates
# into numbers via this array