Skip to content

Instantly share code, notes, and snippets.

View a-sk's full-sized avatar

Skurikhin Alexander a-sk

  • Russia, Saint-Petersburg
View GitHub Profile
@maxcountryman
maxcountryman / kaa.py
Created November 15, 2010 01:35
A very simple non-blocking IRC bot using gevent
import gevent
from gevent import socket, queue
from gevent.ssl import wrap_socket
import logging
logger = logging.getLogger('irc')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
@jed
jed / LICENSE.txt
Created May 10, 2011 16:39 — forked from 140bytes/LICENSE.txt
use anchor tags to parse URLs into components
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mxriverlynn
mxriverlynn / 1-DataBindConvention.js
Created July 29, 2011 17:05
knockout-style data-bind attributes for backbone.js
var DataBindConvention = {
selector: "*[data-bind]",
handler: {
bind: function(selector, view, model){
view.$(selector).each(function(index){
var element = view.$(this);
var databind = element.attr("data-bind").split(" ");
var elementAttr = databind[0];
var modelAttr = databind[1];
@a-sk
a-sk / README.markdown
Created August 17, 2011 16:30 — forked from ariera/README.markdown
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group
@jbjornson
jbjornson / open_filename_under_cursor.py
Created September 1, 2011 13:09
Open the filename from either the current selection or the clipboard. If neither of these are files, then create a new filename based on the selection.
import sublime, sublime_plugin
import os.path, string
VALID_FILENAME_CHARS = "-_.() %s%s%s" % (string.ascii_letters, string.digits, "/:\\")
# { "keys": ["alt+o"], "command": "open_filename_under_cursor" }
# https://gist.github.com/1186126
class OpenFilenameUnderCursor(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@DmitrySoshnikov
DmitrySoshnikov / r-proto-class-class.js
Created November 15, 2011 13:00
R-Proto-Class-Class.js
/**
* r-proto-class-class.js
* Ruby's semantics
*
* Features:
* - super calls
* - using Object.create for inheritance
* - Class.new is a wrapper over Class.allocate and Class.initialize
*
* See also version w/o class(...) wrapper: https://gist.github.com/1366953
@hanachin
hanachin / swank-coffee.el
Created December 6, 2011 20:21
eval region, coffee-script
;;; swank-coffee.el hanachin_
;;;
;;; Copyright (c) 2010 Ivan Shvedunov. All rights reserved.
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@cadar
cadar / smart os nat
Created May 8, 2012 20:36
make nat work with kvm running debian, raw file, I will redo this tomorrow and make sure nothing unnecessary is here
vmadm list
# remove your previous try
export ID=`vmadm list|grep run|cut -b-36` ; echo $ID
export ID=`vmadm list|grep stop|cut -b-36` ; echo $ID
vmadm stop $ID
vmadm destroy $ID
script
dladm show-phys -m
dladm show-link