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
module EasyLayout | |
open System | |
open System.Drawing | |
open Microsoft.FSharp.Quotations | |
open Microsoft.FSharp.Quotations.Patterns | |
open Microsoft.FSharp.Quotations.DerivedPatterns | |
open MonoTouch.Foundation | |
open MonoTouch.UIKit |
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 MonoTouch.UIKit; | |
using MonoTouch.SceneKit; | |
using MonoTouch.Foundation; | |
namespace HelloSceneKit | |
{ | |
public class HelloSceneKitController : UIViewController | |
{ | |
SCNView sceneView; |
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
-- Currying in Haskell | |
add :: Int -> Int -> Int -> Int -> Int | |
add a b c d = a + b + c + d | |
-- use `add 3 7 9 11` | |
// Currying in Swift | |
func add(a: Int) -> (Int -> Int) { | |
func add1(b: Int) -> (Int -> Int) { | |
func add2(c: Int) -> (Int -> Int) { | |
func add3(d: Int) -> Int { |
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
public static class MessageBox | |
{ | |
public static void Show(string title, string message, MessageBoxButton buttons, Action positiveCallback, Action negativeCallback) | |
{ | |
UIAlertView alert = BuildAlert(title, message, buttons); | |
alert.Clicked += (sender, buttonArgs) => | |
{ | |
if (buttonArgs.ButtonIndex == 0) | |
{ |
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
ContentView.ConstrainLayout (() => | |
border.Frame.Top == ContentView.Frame.Top && | |
border.Frame.Height == 0.5f && | |
border.Frame.Left == ContentView.Frame.Left && | |
border.Frame.Right == ContentView.Frame.Right && | |
nameLabel.Frame.Left == ContentView.Frame.Left + hpad && | |
nameLabel.Frame.Right == ContentView.Frame.GetMidX () - 5.5f && | |
nameLabel.Frame.Top >= ContentView.Frame.Top + vpad && |
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
// | |
// Copyright (c) 2013-2015 Frank A. Krueger | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// |
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
/// <summary> | |
/// Processes a given directory, grouping and listing files with duplicate content | |
/// </summary> | |
/// <param name="directory">The path to process</param> | |
private void ListDuplicateFiles(string directory) | |
{ | |
// Calculate and store the hash and path for each file in the directory | |
var files = Directory.GetFiles(directory).Select(f => new { Path = f, Hash = FileHash.CalculateFromFile(f) }); | |
// Group and iterate when duplicates exist |
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 System.Linq; | |
using System.Text; | |
using UnityEngine; | |
public delegate void SuccessHandler(HTTPRequest request); | |
public delegate void ErrorHandler(HTTPRequest request); | |
public class HTTPRequest |
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
public class HashEncryption | |
{ | |
/// <summary> | |
/// Encrypts a string using the MD5 hash encryption algorithm. | |
/// Message Digest is 128-bit and is commonly used to verify data, by checking | |
/// the 'MD5 checksum' of the data. Information on MD5 can be found at: | |
/// | |
/// http://www.faqs.org/rfcs/rfc1321.html | |
/// </summary> | |
/// <param name="Data">A string containing the data to encrypt.</param> |
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
//does the actual coloring | |
void DrawPoints (CGContext dctx) | |
{ | |
dctx.BeginPath (); | |
dctx.MoveTo (Points.First().X, Points.First().Y); | |
dctx.SetLineWidth(swatchSlider.Value); | |
dctx.SetBlendMode (CGBlendMode.Normal); | |
foreach (var crayon in Crayons) { |
NewerOlder