Skip to content

Instantly share code, notes, and snippets.

import Foundation
protocol Alphabet {
associatedtype AlphabetCharacter: Comparable, Hashable
func allCharacters() -> [AlphabetCharacter]
init()
#include <stdio.h>
#define NNodes 22
int Sum, Min, x, y, n, m, c, f[NNodes], st[NNodes], a[NNodes][NNodes];
void back(int k) {
if(k == n + 1) {
if(a[st[n]][st[1]] > 0) {
Sum += a[st[n]][st[1]];
let a = "2"
prop_regex = /@property\s*\([^\)]+\)\s+(?<type>\w+(\s*\*)?)\s*(?<name>\w+)/
code = `pbpaste`
property_list = []
code.scan(prop_regex) do |match|
type, name = match
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>A pure CSS parallax demo by Keith Clark</title>
<style>
/* Parallax base styles
@andrei512
andrei512 / doc.rb
Created April 25, 2015 08:16
the ruby code that won the ccc
require 'socket'
MAX_DIST = 120
@s = TCPSocket.new 'localhost', 7000
def get_number_of_rods
@s.puts "GET_NUMBER"
@s.gets.split.map(&:to_i)
end
var n = 12
var bile = [3, 4, 6, 7, 8, 9, 2, 1, 10, 18, 22, 26]
var extrase = [2, 9, 3, 4, 22, 6]
extrase.sort(<)
bile.sort(<)
var minBall = extrase[0]
@andrei512
andrei512 / hack.swift
Created January 11, 2015 20:04
factory hack
class A {
}
class B {
}
var factory: [String:()->(AnyObject)] = [
"A" : {
@andrei512
andrei512 / google_bot.rb
Created December 3, 2014 18:17
Google bot
require 'watir'
require 'watir-webdriver'
require 'nokogiri'
# require 'os'
require 'json'
query_string = ARGV[0]
# if OS.linux?
# # no more ui
@andrei512
andrei512 / gist:1709c3b6623cc77a4d65
Created November 18, 2014 18:24
smen in python
def filterX(image, region):
return 1.0
def filterY(image, region):
return 2.0
_filters = {
"principalComponentX" : filterX,
"principalComponentY" : filterY