Skip to content

Instantly share code, notes, and snippets.

Avatar

leshy

View GitHub Profile
@leshy
leshy / extendEach.js
Created Jan 15, 2012 — forked from alassek/extendEach.js
Easy multiple-inheritance in Backbone.js
View extendEach.js
/*
multiple inheritance/mixins for backbone js
automatic init call to super classes and defaults attribute inheritance
clsbla = Backbone.Model.extend4000(cls1,cls2,mixin6,{ bla: 3 })
*/
(function () {
@leshy
leshy / graph.js
Created Jan 18, 2012
js backbone graph node - should I use a backbone collection?
View graph.js
var GraphNode = Backbone.Model.extend({
defaults: { parents: [], children: [], name: 'node' },
addparent: function(parent) {
if (!this.hasparent(parent)) {
this.get('parents').push(parent)
this.trigger('addparent',parent)
parent.addchild(this)
var self = this;
parent.bind('destroy',function() { self.removeparent(parent) } )
@leshy
leshy / export-testingfw.js
Created Feb 14, 2012
selenium ide custom export
View export-testingfw.js
function parse(testCase, source) {
}
function format(testCase, name) {
var result = 'ctx.local.c\n';
var commands = testCase.commands;
for (var i = 0; i < commands.length; i++) {
var command = commands[i];
if (command.type == 'command') {
View gist:1929463
jA0EAwMClATSOzNKOxfWye0ufjcE3QZOVIqVUaJ4SV3FLDXAd79AdO+Y1WufUo5k
7UxOedCqq3eLA0BXdZSTYqerQndbHbVS6T1JFmzKtDoHmvUZLy6Os7zIpShD66zO
jab/v++HY8wB78PRZOnLn2WKFrhrJV0SG7VDyqzcqwFPMbi+aMP3c0qV6A2PyqLI
VdItXLnSlVAGMwld30gvzTzZDUFR4q0WeSX3Ncxd1XWfo+Ja9GOxc+98r4WweYIR
yh4dKHV8OrVn1Hz81sZzwCRyoxPo5RjOxO3LY5GboULnrvtHn+EQfGzMmYfCDvw5
YyRDLtef6Myk2w7t/AuLA2hiifWjfwC1EoK1i/rUF3jZfkyzpRYPHAp25ai6Azqn
kSQi8EnJDyXBH4R4gVgVP8eNMRWgIJxqOUbG9ja8LrlOqR+VtD39x16UbN5lv7sW
697G4bsI+JPXRGTDe0PHAbBDGCtX+dR0SiFn2tzBFCQCD2DBQlY3L6FSpHPoRrDj
dLG4GdDU7YaZ+TaLK+0f+ymFcZOznkNkNtF9eH725MajLcIg9BOcNFnyVNGqYfW/
XqcrhMTlh2SDTqWj+xKZxDvcRUHrAbKudQRauQ7SH5dzVIipsBPd+SJJ3etiyJLB
@leshy
leshy / keylogger.py
Created Mar 10, 2012
pyxhook simple crappy keylogger
View keylogger.py
#!/usr/bin/python
import pyxhook
import time
keymap = { 'apostrophe': "'",
'comma': ",",
'period': ".",
'space': " ",
'quotedbl': '"',
'Return': '\n',
@leshy
leshy / prompt.sh
Created Jun 5, 2012
fancy git bash prompt
View prompt.sh
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function git_repo_name {
basename $(git rev-parse --show-toplevel)
}
function git_status {
@leshy
leshy / ai.md
Created Nov 8, 2012
answer to some questions about hard ai and rights
View ai.md
View callable.ls
# a trick that makes class instances function instances and not object instances
# aka - callable objects. (expects object to have a 'call' function defined)
callable = (cls) ->
callable_cls = (...args) ->
obj = (...args) -> obj.call.apply obj, args
obj.__proto__ = cls::
cls.apply obj, args
obj
View keybase.md

Keybase proof

I hereby claim:

  • I am leshy on github.
  • I am lesh (https://keybase.io/lesh) on keybase.
  • I have a public key whose fingerprint is 35DB 878B A6B8 69A8 EE4A B304 C5F7 4693 F248 EF57

To claim this, I am signing this object:

View flycheck-livescript.el
;flycheck livescript
(flycheck-define-checker livescript
"A Livescript syntax checker using livescript.
See URL `http://livescript.net/'."
:command ("livescript" "--compile" "--print" "--stdin")
:standard-input t
:error-patterns
((error line-start "[" (message) "on line " line "]" line-end))
:modes livescript-mode)
You can’t perform that action at this time.