Skip to content

Instantly share code, notes, and snippets.

View Dremora's full-sized avatar

Kirill Korolyov Dremora

View GitHub Profile
@Dremora
Dremora / gist:709312
Created November 22, 2010 00:00
EventStream
require 'sinatra'
require 'eventmachine'
class EventStream
include EventMachine::Deferrable
def initialize(channel, &block)
@channel = channel
@block = block
@Dremora
Dremora / InputBox.diff
Created December 11, 2011 04:41
Monochrome — Ctrl+Backspace/Ctrl+Delete key support
*** InputBoxOriginal.cs Thu May 22 14:19:10 2008
--- InputBox.cs Sun Dec 11 05:44:10 2011
***************
*** 6,11 ****
--- 6,12 ----
using System.Text;
using System.Windows.Forms;
using IRCUtils;
+ using System.Text.RegularExpressions;
@Dremora
Dremora / circles.js
Last active October 1, 2015 01:17
Fancy circles
var ctx;
var x = 0;
$(function() {
ctx = $('#canvas')[0].getContext("2d");
return setInterval(draw, 10);
});
function draw() {
ctx.clearRect(0, 0, 600, 600);
@Dremora
Dremora / Preferences.sublime-settings
Created June 14, 2012 08:33
My Sublime Text configuration
{
"color_scheme": "Packages/Color Scheme - Default/LAZY.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_size": 12.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"mouse_wheel_switches_tabs": true,
"rulers":
@Dremora
Dremora / index.html
Created September 13, 2012 14:11
Checkpoint
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<title>CHECKPOINT - exciting team game - </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
<!--<a href="http://ran.ge/" title="Professional WordPress Development" id="range-logo">Range Web Development</a>#-->
<body>
<div id="body">
<img src="/test/style/bg.gif" width="800" height="600" usemap="logomap">
<map name="logomap">
@Dremora
Dremora / gist:9fdb76b5d3c3b9fba54f
Created December 10, 2014 14:47
Binding functions to the 2nd argument
var numbers = ['10', '10', '10', '10'];
numbers.map(parseInt);
// [10, NaN, 2, 3]
var bind2nd = function (fn, val) {
return function () {
var newArgs = [arguments[0], val].concat(Array.prototype.slice.call(arguments, 1))
return fn.apply(null, newArgs);
}
};
define(function (require) {
require('hbs!./template');
});
@Dremora
Dremora / Scrolling-without-scrollbar.markdown
Created January 8, 2015 12:31
Scrolling without scrollbar
@Dremora
Dremora / gist:b052655dd1c5c81d7628
Created January 9, 2015 11:32
groupBy Backbone collection
var Backbone = require('backbone');
var CollectionModel = Backbone.Model.extend({
initialize: function () {
this.collection = new Backbone.Collection();
},
add: function () {
this.collection.add.apply(this.collection, arguments);
},
var input
// Synchronous code
var a_ = a(input)
var b_ = b(a_)
var output = c(b_)
// Synchronous code, short
var output = c(b(a(_)))