Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomasz Janczuk tjanczuk

View GitHub Profile
@tjanczuk
tjanczuk / mono.rb
Created Apr 5, 2014
Install Mono 64 bit
View mono.rb
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.0.7.tar.bz2'
homepage 'http://www.mono-project.com'
sha1 '0699c119f6aded3912797b45049932609020bc29'
def install
args = ["--prefix=#{prefix}",
"--with-glib=embedded",
@tjanczuk
tjanczuk / hello.cs
Created Apr 9, 2014
Mono async lambda with closure over local state throws InvalidProgramException
View hello.cs
using System;
using System.Threading.Tasks;
public class HelloWorld
{
static public void Main ()
{
var k = 3;
var f = new Func<object,Task<object>>(async (i) => { return ++k; });
f(12); // throws "System.InvalidProgramException: Invalid IL code in HelloWorld/<Main>c__async0:MoveNext (): IL_0014: add"
View compile.cs
using Microsoft.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
public class EdgeCompiler
{
static string source =
"using System;\n"
+ "using System.Threading.Tasks;\n"
View JSConf.US
DETAILS: Seattle/Jacksonville
From http://matrix.itasoftware.com
ITINERARY
Seattle (SEA) to Jacksonville (JAX) - Tue, May 27
American Airlines Inc. 1308 Dep: 7:20AM Arr: 1:15PM 3h 55m Boeing 737 Coach (G)
Layover in DFW 1h 35m
American Airlines Inc. 386 Dep: 2:50PM Arr: 6:10PM 2h 20m MD-80 Coach (G)
View repl.ws.test.html
<html>
<head>
<script src="http://repl.ws/js/mykey1"></script>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
View dockerbuild.sh
#!/bin/bash -v
# Builds a Docker image using name and version from package.json next
# to Dockerfile as name and tag of a Docker image.
#
# Usage: dockerbuild <path_to_Dockerfile_directory>
set -eux
pushd $1
IMAGE_NAME=$(node -e "console.log(require('./package.json').name)")
View WT1.js
return function(context, cb) {
cb(null, context);
}
@tjanczuk
tjanczuk / call_sandbox.html
Last active Aug 29, 2015
call_sandbox.html
View call_sandbox.html
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
$(function () {
$.post({
url: 'https://sandbox-dev.it.auth0.com:8721/auth0?name=Tomek',
headers: {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6IjEifQ.eyJqdGkiOiI5YWRmYTA4NmY5ZmE0ZmZmYmIzYjFiMzIzODc1N2NhMSIsImlhdCI6MTQyNDc1ODgzNiwidXJsIjoiaHR0cHM6Ly9naXN0LmdpdGh1YnVzZXJjb250ZW50LmNvbS90amFuY3p1ay81ODI4Yzc3ZTI1OWU1ZGU0OWRhYi9yYXcvNWUyMWM1ZjljYTZmZDE5MWFhYzdhMmNhYmM5MjgwOGJiMDQwMmE0ZS9XVDEuanMiLCJlY3R4IjoiRXVHai9LYzRNWHpsSGIvQ01RS3c1UT09LklhK24yeTRRd1lSWVRPVVd1VVRCanc9PSJ9.MQSxTFrUcMc4uXZ41lHNL22q1f0sa_wC2jrseFkoFFA'
}
View HelloWorld.js
return function (context, cb) {
cb(null, "Hello, " + context.data.name || 'Anonymous');
}
View secret.js
return function (context, cb) {
cb(null, {
message: context.data.message,
has_secret: context.data.secret !== undefined
});
}