Skip to content

Instantly share code, notes, and snippets.

@corani
corani / goodrelations-example.html
Created November 14, 2010 04:51
Code example of embedding the GoodRelations vocabulary in a product offer page using RDFa
<div
xmlns:gr="http://purl.org/goodrelations/v1#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
typeof="gr:Offering" about="#product_data">
<span property="gr:name">Protective Sleeve for HyperPhone</span>
<span rel="gr:hasPriceSpecification">
<span typeof="gr:UnitPriceSpecification">
Price: $<span property="gr:hasCurrencyValue" datatype="xsd:float">19.99</span>
<span property="gr:hasCurrency" content="USD" datatype="xsd:string"></span>
@corani
corani / functional.java
Created March 30, 2011 05:35
Setup data
List<Integer> items = Arrays.asList(
new Integer[] { 1, 2, 3, 5, 8, 13, 21 });
List<Integer> result = new ArrayList<Integer>();
for (Integer value : items) {
result.add(Math.pow(value, 2));
}
Integer result = 0;
for (Integer value : items) {
result = result + value;
}
List<Integer> result = new ArrayList<Integer>();
for (Integer value : items) {
if (value % 2 == 0) {
result.add(value);
}
}
@corani
corani / anagrams.pas
Last active August 29, 2015 14:05
Oberon-2 sample for finding Anagrams.
MODULE Anagrams;
TYPE STRING = ARRAY 10 OF CHAR;
Word = POINTER TO WordRec;
WordRec = RECORD
text : STRING;
next : Word
END;
Node = POINTER TO NodeRec;
NodeRec = RECORD
MODULE Anagram;
IMPORT Std, Map, Vector, String;
TYPE ANAGRAM* = POINTER TO AnagramRec;
AnagramRec = RECORD
words : Map.MAP
END;
PROCEDURE newDict*() : ANAGRAM;
@corani
corani / proxy.ps1
Created January 15, 2015 06:10
Automatically set proxy configuration
$flip = (Get-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections' -Name DefaultConnectionSettings).DefaultConnectionSettings
$flip[8] = "3"
Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections' -Name DefaultConnectionSettings -Value $flip
Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable -Value 1
Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyOverride -Value "<local>"
Set-ItemProperty -Path 'registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyServer -Value "<server>:<port>"
@corani
corani / keybase.md
Created January 21, 2015 10:54
keybase.md

Keybase proof

I hereby claim:

  • I am corani on github.
  • I am corani (https://keybase.io/corani) on keybase.
  • I have a public key whose fingerprint is D8D0 9FBE F075 F709 7B52 2F73 326C 2123 EF2D 5D91

To claim this, I am signing this object:

@corani
corani / bowling.ss
Created December 25, 2017 07:02
Bowling Game Kata in Scheme
#lang racket
(require
rackunit
rackunit/text-ui
)
(define (bowling rolls)
(define (spare? rolls)
(= (+ (first rolls)