View let-property-example.swift
class LetExample {
let name: String?
init(let _ name: String?) {
self.name = name
}
func sayMyName() -> String {
if let myName = self.name {
return "My name is \(myName)"
View pg-multi-dict-optionals.swift
import Cocoa
let example1: [String: NSNumber] = ["a":10, "b":20, "c":30]
let example2: [String: NSNumber] = ["a":10, "c":30]
var ex = example1;
if let a = ex["a"]?.integerValue {
if let b = ex["b"]?.integerValue {
if let c = ex["c"]?.integerValue {
View gist:05117207ab80627baac0
(*
This script scans Evernote for notes, in a variety of ways, and adds references to them into OmniFocus
as inbox items. The point is to remove the necessity of reviewing your notes in Evernote to determine
if action needs to be taken by manually looking for the same sorts of things in Evernote yourself.
A typical use case scenario would be:
1. You are browsing the web and you see an article you are interested in reading later
2. You use Evernote Webclipper to save the article, perhaps simplified for reading.
3. The script eventually runs via Cron job or otherwise and adds a task to OmniFocus
View gist:131c1c6dd4e671db739a
var numbers: String = "1234567890"
for numberChar in numbers {
var numberString:String = String(numberChar)
}
View div-based-bidi-scrolling-table.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8"/>
<title></title>
<script src="/js/jquery-2.1.1.js"></script>
<style type="text/css">
.divtable {
position: relative;
overflow: auto;
View rawenumurltype.swift
import Foundation
public enum Region: String {
static var _regionURLCache = [String: NSURL]();
case One = "http://region.meh/one";
case Two = "http://region.meh/two";
case Three = "http://region.meh/three";
public func URL() -> NSURL? {
var url: NSURL? = Region._regionURLCache[self.rawValue]
View uglystructrawenum.swift
import Foundation
public struct RegionStruct: StringLiteralConvertible, Equatable {
let name: String
let platformId: String
let host: NSURL
typealias UnicodeScalarLiteralType = Character
View gist:775310
int validityDays = 0;
validityDays = Integer.parseInt(validityString);
Calendar tmpCal = Calendar.getInstance();
tmpCal.add(Calendar.DAY_OF_YEAR, validityDays);
Date notBefore = new Date(); // Right now
Date notAfter = tmpCal.getTime();
Vector<String> names = new Vector<String>();
Vector<DERObjectIdentifier> order = new Vector<DERObjectIdentifier>();
View tryme.erl
-module(tryme).
-export([main/0]).
loop(A, B, C, D) when B /= D ->
io:fwrite("~s~B~n", [A,B]),
loop(A, C(B), C, D);
loop(A, B, _, _) ->
io:fwrite("~s~B~n", [A, B]),
ok.
View round.html
<html>
<body>
<br/>
<br/>
<button style="width: 40em; height: 40em;">O</button>
<button style="width: 40em; height: 40em;">O</button>
</body>
</html>