Skip to content

Instantly share code, notes, and snippets.

@zenlor
zenlor / Backbone.reqwest.js
Created September 21, 2011 14:39
Backbone.js Sync method for reqwest.js and Ender.js
(function (reqwest, Backbone) {
var methodMap, getUrl;
methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read' : 'GET'
};
getUrl = function(object) {
@zenlor
zenlor / Benchmark-ish.js
Created December 26, 2011 15:35
walk(dirname, callback, finished) - asynchronous directory traversal in node.js
var fs = require('fs')
, path = require("path")
, cp = require('child_process')
, Step = require('step')
, colors = require('colors')
, start = Date.now();
walk = (function() {
var counter = 0;
var walk = function(dirname, callback, finished) {
@zenlor
zenlor / app.js
Created February 14, 2012 11:09
daemonizing wrapper for node apps
var express = require('express')
, app = module.exports = express.createServer();
// you express app resides here ...
var utils = require('./utils')
, shasum = utils.shasum
, shahmac = utils.shahmac
, randuid = utils.randuid;
// ## User Schema
//
User = new Schema({
uid: String,
pwd: String,
@zenlor
zenlor / demo.html
Created March 23, 2012 14:55
lazy loader
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='lazyload.js'></script>
<style type='text/css'>
@zenlor
zenlor / dabblet.css
Created April 17, 2012 15:46
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
* adf
*/
body {
background: linear-gradient(45deg, #e06, #CFF);
min-height: 100%;
}
foo {
@zenlor
zenlor / controller.rb
Created June 8, 2012 14:32
inplace editing with ender
Admin.controllers :photos do
post :rename do
if params[:gallery]
Photo.set({:gallery => params[:gallery]}, {:gallery => params[:name], :gallery_slug => params[:name].to_slug})
{name: params[:name]}.to_json
else
403
end
end

The name's Sam! I live in Sibera,Russia. You wonder where it might be? Oh c'mon! Everyone knows that Siberia is a snow desert somewhere deep in Russia.

We still got internet, but the rest of the modern stuff is not here. However I managed to setup a studio using a lot of cardboard, Soviet synthesizers and iMac G4 Besides I borrowed a camera from my next-door buddy.

You wonder what could be produced out of such a garbage?? I'll tell you what!

@zenlor
zenlor / GestPayCryptHS.java
Created October 17, 2012 17:01
GestPay (just cause I hate them)
import java.io.*;
import java.awt.*;
import java.util.*;
import java.net.*;
/**
* Crypt-Decrypt Hi security object.
// Author: Sellanet.
// Version 2.0 Hi Security (HTTPS Server to Server comunications)
$(document).keydown(function (event) {
if (event.ctrlKey) { return false; }
var code = (event.keyCode ? event.keyCode : event.which);
if (code == 17 || code == 224) { return false; }
});
$(function () {
$("body").bind('mousedown', function (event) {
if (event.target.id != 'ctl00_HeaderBox_header_TextBoxSearch' && !(event.target.id.toLowerCase().indexOf('img') == -1 || event.target.id.toLowerCase().indexOf('flash') == -1))
return false;