Skip to content

Instantly share code, notes, and snippets.

View vojto's full-sized avatar
🎯
Focusing

Vojtech Rinik vojto

🎯
Focusing
View GitHub Profile
:set shiftwidth=2
:set tabstop=2
:set guifont=Hack:h12
:set nofoldenable
colorscheme OceanicNext
map <F12> mzgg=G`z
map <D-/> gcc
// Pick
public extension SignalProducer where Value: OptionalProtocol {
func pick<T>(picking: @escaping ((Value.Wrapped) -> (SignalProducer<T?, Error>))) -> SignalProducer<T?, Error> {
return self.flatMap(.latest) { value -> SignalProducer<T?, Error> in
if let value = value.optional {
return picking(value)
} else {
return SignalProducer<T?, Error>(value: nil)
}
@vojto
vojto / Data.cs
Created September 28, 2016 08:41
public static Int64 GetTimeStamp(
int year, int month, int day,
int hour, int minute, int second, int milliseconds)
{
Int64 timestamp = DateToTicks(year, month, day)
+ TimeToTicks(hour, minute, second);
return timestamp + milliseconds * TicksInMillisecond;
}
#!/usr/bin/env node
'use strict';
var cmd = function () {
var request = require('request'),
async = require('async'),
@vojto
vojto / gist:5186687
Created March 18, 2013 11:57
Python script that will create a mix for interval running
import os
import re
from echonest.remix.action import render
import echonest.remix.audio as audio
FIRST_SLOW_TIME = 180
SLOW_TIME = 90
FAST_TIME = 60
# Oddelenie
entity Oddelenie {
nazov : string required, length 5 30
kod : string required, length 1 4
uroven : real
}
# Zamestnanec
entity Zamestnanec {
meno : string required, length 2 30
@interface NKStyle : NSObject
@property (assign) CGRect frame;
- (id)initWithFrame:(CGRect)frame;
// Background
@property (nonatomic, strong) NKColor *backgroundColor;
// Border
@property (assign) CGFloat borderRadius;
// From anywhere
NKDrawGradientWithHexColors(c, drawingRect, @"f0eef1", @"fbfbfc");
NKDrawBorder(c, drawingRect, NKBorderBottom, 1, @"red");
// From NSView
- (void)style {
[self drawGradientStartColor:@"f0eef1" endColor:@"fbfbfc"];
[self drawBorder:NKBorderBottom lineWidth:1 color:@"red"];
}
# encoding: utf-8
# Alan
# Two-stack Turing machine simulator
#
# Author: Vojtech Rinik <[email protected]>
# License: MIT
# Example program:
@vojto
vojto / gist:4502928
Created January 10, 2013 15:38
Ruby simulator of Turing Machine with two stacks.
# encoding: utf-8
require "parslet"
require "pp"
require "ap"
require "colored"
program = "q0, (¢,Z,Z), (¢,B,B), q0, (R,-,-)
// Ak pride a, striedavo uklada a raz na 1. raz na 2. zasobnik.