git init
or
#!/usr/bin/env xcrun swift -O | |
/* | |
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3 | |
-------------------- https://gist.github.com/cfdrake/973505 --------------------- | |
gen.swift implements a genetic algorithm that starts with a base | |
population of randomly generated strings, iterates over a certain number of | |
generations while implementing 'natural selection', and prints out the most fit | |
string. | |
The parameters of the simulation can be changed by modifying one of the many |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
(ns jquerytest.core) | |
(def jquery (js* "$")) | |
(jquery | |
(fn [] | |
(-> (jquery "div.meat") | |
(.html "This is a test.") | |
(.append "<div>Look here!</div>")))) |
using System; | |
using System.Linq; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace Jason.Tests { | |
[TestClass] | |
public class TryParseTests { | |
[TestMethod] | |
public void TestTryParse_Func_Bad() { | |
Assert.AreEqual(0, "s".TryParse(Failover<int>)); |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
using Jurassic; | |
using Jurassic.Library; | |
namespace NotActuallyTheDlrCoffee |
### | |
Modified from https://github.com/jashkenas/coffee-script/blob/master/Cakefile | |
Part of an upcoming PeepCode screencast. This snippet is MIT Licensed. | |
### | |
{spawn, exec} = require 'child_process' | |
task 'assets:watch', 'Watch source files and build JS & CSS', (options) -> | |
runCommand = (name, args) -> |
// Func<IRequest, IResponse> | |
public interface IApplication { | |
IAsyncResult BeginInvoke(IRequest request, AsyncCallback callback, object state); | |
IResponse EndInvoke(IAsyncResult result); | |
} |
// HOWTO: load LABjs itself dynamically! | |
// inline this code in your page to load LABjs itself dynamically, if you're so inclined. | |
(function (global, oDOC, handler) { | |
var head = oDOC.head || oDOC.getElementsByTagName("head"); | |
function LABjsLoaded() { | |
// do cool stuff with $LAB here | |
} |