Skip to content

Instantly share code, notes, and snippets.

View andreyvit's full-sized avatar

Andrey Tarantsov andreyvit

View GitHub Profile
@andreyvit
andreyvit / ObservationPlayground.swift
Last active August 29, 2015 14:04
Code from “In search of a clean closure-based observation API in Swift” on Apple Dev Forums
import Foundation
func weakify<T: AnyObject>(object: T, block: (T) -> Void) -> () -> Void {
weak var weakObject = object
return {
if let strongObject = weakObject {
block(strongObject)
}
}
}
@andreyvit
andreyvit / wwdc-2014-summaries.md
Last active August 29, 2015 14:06
WWDC 2014 Summaries

A Look Inside Presentation Controllers (228)

TODO.

A Strategy for Great Work (237)

  1. “Know a good idea when you see it”: a demo of KHTML running on a Mac, made in 2 days, helped them pick it for Safari.

  2. “Don't try to solve every problem at once”: was extracting KHTML from KDE, had no idea how it worked, just compiled one file at a time, and stubbed missing functions one at a time.

{
init: function(elevators, floors) {
var DIR_UP = 1, DIR_DOWN = -1, DIR_IDLE = 0;
var FLOOR_NINF = -1, FLOOR_PINF = 1000;
var floorUpRequests = [];{
init: function(elevators, floors) {
var DIR_UP = 1, DIR_DOWN = -1, DIR_IDLE = 0;
var FLOOR_NINF = -1, FLOOR_PINF = 1000;
@andreyvit
andreyvit / raid.h
Created August 10, 2015 06:41
One of the finer pieces of code I have ever written
#ifndef _RAID_H_
#define _RAID_H_
#define RAID_LEVEL 3
#define RAID_WRITE(stat) do {int raidi; for(raidi = 0; raidi < RAID_LEVEL; ++raidi) stat;} while(0)
#define raidwr raid[raidi]
#define raidrd raid[0]
GlobalState raid[RAID_LEVEL];
@andreyvit
andreyvit / gist:10420
Created September 12, 2008 10:58
undefined
PLEASE ABSTAIN FROM ABSTAIN
+--1++<<<>>==<<>>
package com.esko.dtl.core.typeinferencing.constructs.dtl;
import com.esko.dtl.core.ast.ArrayAccess;
import com.esko.dtl.core.typeinferencing.goals.ExpressionValueInfoGoal;
import com.esko.dtl.core.typeinferencing.goals.ValueInfoGoal;
import com.yoursway.sadr.core.ValueInfoContinuation;
import com.yoursway.sadr.engine.Continuation;
import com.yoursway.sadr.engine.ContinuationRequestorCalledToken;
import com.yoursway.sadr.engine.ContinuationScheduler;
import com.yoursway.sadr.engine.InfoKind;
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: unable to execute statement; nested exception is:
java.sql.SQLException: ORA-02291: Integrit?ts-Constraint (KTPS_ALLESKLAR.ASS_TARGET_ELM_ID_2_ELM_ID) verletzt - ?bergeordneter Schl?ssel nicht gefunden
ORA-06512: in "KTPS_ALLESKLAR.PCK_RELATION", Zeile 252
ORA-06512: in "KTPS_ALLESKLAR.PCK_RELATION", Zeile 343
ORA-06512: in "KTPS_ALLESKLAR.PCK_RELATION", Zeile 319
ORA-06512: in Zeile 2
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
commit 39409899d95976981cea80dc140ed2b05953fb72
Author: Andrey Tarantsov <andreyvit@gmail.com>
Date: Sun Oct 12 22:24:11 2008 +0700
Extended all backgrounds to the border of the page
diff --git a/css/yoursway.css b/css/yoursway.css
index bcc5132..565f196 100644
--- a/css/yoursway.css
+++ b/css/yoursway.css
say -v Cellos "oh This is a silly song silly song silly song this is the silliest song ive ever ever heard So why keep you listening listening listening while you are supposed to work to work to work to work its because i hate my job hate my job hate my job its because i hate my job more than anything else"
require 'date'
def print_timesheet(first, last)
last_month = nil
first.upto(last) do |cur|
if last_month != cur.mon
puts
puts Date::MONTHNAMES[cur.mon]
puts