Skip to content

Instantly share code, notes, and snippets.

View buger's full-sized avatar
🏠
Working from home

Leonid Bugaev buger

🏠
Working from home
View GitHub Profile
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/webkit'
body = "<html>
<body>
<div id='div_example'></div>
<iframe id='iframe_example'></iframe>
</body>
[21:44:58][Boxes] SOCKET Node ["click", "1"]
[21:44:58][Boxes] >> Node
[21:44:58][Boxes] >> 2
[21:44:58][Boxes] >> 5
[21:44:58][Boxes] >> click
[21:44:58][Boxes] >> 1
[21:44:58][Boxes] >> 1
[21:44:58][Boxes] << ok
[21:44:58][Boxes] << 0
[21:44:58][Boxes] <<
@buger
buger / gist:1907352
Created February 25, 2012 08:36
Handling server maintenance
https://granify.acunote.com/projects/29417/tasks/516
@buger
buger / gist:1687945
Created January 27, 2012 09:25
Matching js
  if top is window
    bindReady =>
      @client  = new ClientInfo

should become

 if top is window
@buger
buger / gist:1345486
Created November 7, 2011 16:49
Монтекарло методом площадей
function q2 =pl(a,b,N)
// Высота графика
G=4;
q2 = zeros(1,10);
for i=1:10
// Количество точек попавших под график
Хранение в базе Поля на форме
- Мебель props: [@цвет] [@цвет]
@Цвет
- Столы props: [@тип_стола,@кол-во_ног] [@цвет, @тип_стола, @кол-во_ног]
@тип_стола ^
@кол-во_ног унаследован от Мебель
- Cтол Икеа props: [@артикул] [@цвет, @тип_стола, @кол-во_ног, @артикул]
<html>
<head>
function handleMessage(msgEvent) {
var messageName = msgEvent.name;
var messageData = msgEvent.message;
if (messageName === "playClicked")
_gaq.push(['_trackEvent', 'playerControls', 'PlayClicked']);
}
}
var towns = ['Калининград', 'Вологда', 'Алматы', 'Дмитров', 'Архангельск', 'Тобольск', 'Краков'];
var variants = [];
function get_town(town, towns, result, index){
if(!index)
index = 1;
var i;
var suggested_towns = [];
from twisted.web import server, resource
from twisted.internet import reactor, threads
import time
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
d = threads.deferToThread(self.loooong_rendering, request)
class Complex
{
// DECLARE THE SPECIFIED GLOBAL FUNCTION AS A FRIEND
// OF THIS CLASS...
friend Complex operator+(double, Complex);
public:
Complex(float re, float im)
: myReal(re), myImag(im)