This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using MonoMac.Foundation; | |
using MonoMac.AppKit; | |
using MonoMac.ObjCRuntime; | |
using Cadenza; | |
namespace MySecretApp { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static IEnumerable<TSource> SkipWhileImpl<TSource>( | |
IEnumerable<TSource> source, | |
Func<TSource, bool> predicate) | |
{ | |
return SkipWhileImpl (source, (element, index) => predicate (element)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/runhaskell | |
import Data.List | |
import Control.Monad | |
import System.Process (readProcess) | |
import System.Environment (getArgs) | |
import System.Directory (doesFileExist, removeFile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
ARGV.group_by { | |
|file| `md5 #{file}`.split.last | |
}.values.map { | |
|dups| dups.drop 1 | |
}.flatten.each { | |
|dup| File.delete dup | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Diagnostics; | |
using MonoMac.AppKit; | |
using MonoMac.Foundation; | |
namespace Awareness | |
{ | |
public static class NSApplicationExtensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSH_ENV="$HOME/.ssh/environment" | |
# start the ssh-agent | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
# spawn ssh-agent | |
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV" | |
echo succeeded | |
chmod 600 "$SSH_ENV" | |
. "$SSH_ENV" > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require 'fs' | |
class MyClass | |
# Trying to create middleware with access to class members. | |
withData: (cb) -> | |
return cb @__data if @__data? | |
fs.readFile 'datafile.json', (err, json) => | |
throw err if err? | |
@__data = JSON.parse json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findRoots 0 b c = Nothing | |
findRoots a b c = Just ((-b + d) / 2*a, (-b - d) / 2*a) | |
where d = sqrt (b^2 - 4*a*c) | |
main = print (findRoots 1 6 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- findRoots is a function that takes 3 Doubles and maybe returns a tuple of doubles. | |
-- Here's its signature, which can be omitted because Haskell infers it: | |
findRoots :: Double -> Double -> Double -> Maybe (Double, Double) | |
-- In a C-like language with parameterized types, the type signature might look like: | |
-- | |
-- static Maybe<Tuple<double,double>> findRoots(double a, double b, double c); | |
-- | |
-- Maybe is Haskell's 'nullable type'; values of type Maybe t can be thought of as lists | |
-- containing exactly zero or one value of type t. So, a Maybe Double is either zero or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register an API key in your AppDelegate's FinsihedLaunching method: | |
// GMSServices.ProvideAPIKey ("Your API key."); | |
GMSMapView mapView; | |
public override void ViewDidLoad () | |
{ | |
base.ViewDidLoad (); | |
// Create the map view, framing Xamarin headquarters |