Skip to content

Instantly share code, notes, and snippets.

View hedefalk's full-sized avatar

Viktor Hedefalk hedefalk

View GitHub Profile
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@hedefalk
hedefalk / eclipse.ini
Created May 5, 2011 14:46
eclipse.ini
-startup
../../../plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.2.R36x_v20101019_1345
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
@oxbowlakes
oxbowlakes / ScalaSolarizedDark.xml
Created June 20, 2011 13:13
ScalaSolarizedDark.xml
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="OxbowSolarizedDark" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.2" />
<option name="EDITOR_FONT_SIZE" value="13" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="" />
<option name="ANNOTATIONS_COLOR" value="2b36" />
<option name="ANNOTATIONS_MERGED_COLOR" value="" />
<option name="CARET_COLOR" value="dc322f" />
@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
13:29 ~/Projects/Kepler_introduce-member/sandbox (topic/introduce-member)$ cat Macros.scala
import scala.reflect.macros.Context
import language.experimental.macros
object Macros {
def impl(c: Context)(target: c.Tree, name: c.Tree, code: c.Tree) = {
import c.universe._
val Literal(Constant(targetType: Type)) = c.typeCheck(target)
val Literal(Constant(methodName: String)) = name
val Function(methodParams, methodBody) = code
#!/bin/sh
# btsync service
# Replace with linux users you want to run BTSync clients for
BTSYNC_USERS="mendel"
DAEMON=/usr/bin/btsync
start() {
for btsuser in $BTSYNC_USERS; do
HOMEDIR=`getent passwd $btsuser | cut -d: -f6`
config=$HOMEDIR/.sync/config.json
@leonderijke
leonderijke / svgfixer.js
Last active June 17, 2024 07:57
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@thoradam
thoradam / io.ts
Created March 5, 2020 15:02
Pure TypeScript
// Did you know JavaScript has pure functions*?
// *: just add asterisks!
/**
* Describes a computation that requires `E` to produce an `A`. Has to be run
* to do anything.
*
* We could also do something like:
* `type Async<E,A> = Generator<void,Promise<A>,E>`
*/