Skip to content

Instantly share code, notes, and snippets.

@osdrv
osdrv / nginx.conf
Created March 15, 2012 10:52
nginx config
server {
listen 80;
server_name ~.*$;
charset utf8;
location / {
root /Users/4pcbr/workspace/dart;
expires 0;
index index.html index.htm;
}
class A
attr_accessor :b
def with_b( new_b, &blk )
original_b = b
self.b = new_b
yield if block_given?
self.b = original_b
end
end
public void withTranslate( float tx, float ty, Runnable scope_runner ) {
pushMatrix();
translate( tx, ty );
scope_runner.run();
popMatrix();
}
public void withTranslate( float tx, float ty, float tz, Runnable scope_runner ) {
pushMatrix();
translate( tx, ty, tz );
withEllipseMode( CENTER, new Runnable() { public void run() {
withTranslate( SHADOW_DISPOSE_X, SHADOW_DISPOSE_Y, new Runnable() { public void run() {
withRotate( -PI / 2, new Runnable() { public void run() {
withRotate( 2 * PI * hours / 12, new Runnable() { public void run() {
rect( round( ( CLOCK_HOUR_ARROW_LENGTH ) / 2 * scale_factor ), 0,
round( ( CLOCK_HOUR_ARROW_LENGTH + CLOCK_HOUR_ARROW_WIDTH ) * scale_factor ), round( CLOCK_HOUR_ARROW_WIDTH * scale_factor ), round( CLOCK_HOUR_ARROW_WIDTH * scale_factor / 2 ) );
} } );
withRotate( 2 * PI * minutes / 60, new Runnable() { public void run() {
rect( round( ( CLOCK_MINUTE_ARROW_LENGTH ) / 2 * scale_factor ), 0,
round( ( CLOCK_MINUTE_ARROW_LENGTH + CLOCK_MINUTE_ARROW_WIDTH ) * scale_factor ), round( CLOCK_MINUTE_ARROW_WIDTH * scale_factor ), round( CLOCK_MINUTE_ARROW_WIDTH * scale_factor / 2 ) );
@osdrv
osdrv / processing.rb
Created March 26, 2012 11:06
processing app generator
#!/usr/bin/env ruby
require "trollop"
require "active_support/inflector"
class AppBuilder
class << self
def file_template( opts = {} )
<<-eos
#{"import processing.opengl.*;" if opts[:mode]=="opengl"}
@osdrv
osdrv / .vimrc
Created May 2, 2012 20:19
my vim config
set guifont=Monaco:h14
"set bg=dark
set ts=2
set sw=2
set sts=2
set expandtab
set nu nu
set syntax=on
highlight clear
syntax reset
@osdrv
osdrv / gist:2700313
Created May 15, 2012 09:18
Cakefile
fs = require 'fs'
{exec} = require 'child_process'
util = require 'util'
growl = require 'growl'
appFiles = [
]
exclude = /chanto/
@osdrv
osdrv / gist:2720924
Created May 17, 2012 19:02
my_wedding.js
// http://rezerv.moszags.ru/slots/22987
// http://rezerv.moszags.ru/slots/22988
// http://rezerv.moszags.ru/slots/22989
$("#slot_applicant_attributes_surname1").val("Сидоров");
$("#slot_applicant_attributes_name1").val("Олег");
$("#slot_applicant_attributes_middle_name1").val("Сергеевич");
$("#slot_applicant_attributes_born_s1").val("25.07.1986");
$( "#slot_applicant_attributes_surname2" ).val("Чупрова");
$( "#slot_applicant_attributes_name2" ).val("Ирина");
set :application, 'SBRFRoadshow'
set :scm, :git
set :repository, '[email protected]:/etc/git/customizer.git'
set :deploy_to, "/var/app/#{application}"
set :user, 'User'
set :use_sudo, false
set :normalize_asset_timestamps, false
server '192.168.0.10', :app, :web, :db, :primary => true
set :platform, "windows64"
function interPathHelper(path1, path2, justCount) {
path1 = R._path2curve(path1);
path2 = R._path2curve(path2);
var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,
res = justCount ? 0 : [];
for (var i = 0, ii = path1.length; i < ii; i++) {
var pi = path1[i];
if (pi[0] == "M") {
x1 = x1m = pi[1];
y1 = y1m = pi[2];