Skip to content

Instantly share code, notes, and snippets.

Geoffrey Wiseman geoffreywiseman

View GitHub Profile
@geoffreywiseman
geoffreywiseman / example-industrious-one.sil
Last active Dec 27, 2016
Comparing lazy to "industrious" properties at the SIL level.
View example-industrious-one.sil
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// static CommandLine._argc
sil_global [fragile] @_TZvOs11CommandLine5_argcVs5Int32 : $Int32
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4
@geoffreywiseman
geoffreywiseman / Countdown.rb
Last active Nov 24, 2016
Game simulation of 4-way countdown, one in Ruby, one in Swift.
View Countdown.rb
class Game
def initialize()
@turn_index = 0
@players = [Player.new(1), Player.new(2)]
@players.first.set_opponent(@players.last)
@players.last.set_opponent(@players.first)
end
def take_turn
View Signpost.swift
import Foundation
public class Signpost {
static func start( code:UInt32, arg1:UInt = 0, arg2:UInt = 0, arg3:UInt = 0, arg4:UInt = 0 ) -> Int32 {
if #available(iOS 10.0, *) {
return kdebug_signpost_start(code,arg1,arg2,arg3,arg4);
} else {
return 0;
}
}
@geoffreywiseman
geoffreywiseman / Validator.java
Created Jul 1, 2014
Uber-Simple Use of the RAML Parser as a Validator
View Validator.java
package org.raml;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
import org.raml.parser.rule.ValidationResult;
import org.raml.parser.visitor.RamlValidationService;
View School.java
public class School {
private final String name;
private final String nickname;
public School(String name, String nickname) {
this.name = name;
this.nickname = nickname;
}
@Override
@geoffreywiseman
geoffreywiseman / reset-twitter-spaces.rb
Created May 20, 2011
Ruby code using rb-appscript to reset Twitter's preferences in Spaces since Twitter doesn't work very well with OSX Spaces.
View reset-twitter-spaces.rb
require "rubygems"
require "appscript"
include Appscript
class SystemEvents
def initialize( &block )
@app = app( "System Events" )
launch
instance_eval &block
@geoffreywiseman
geoffreywiseman / prune-dsl.rb
Created Dec 17, 2010
An example of what a prune DSL could look like.
View prune-dsl.rb
preprocess do |file|
file.modified_time = File.mtime( file.name )
modified_date = Date.parse modified_time.to_s
file.days_since_modified = Date.today - modified_date
file.months_since_modified = ( Date.today.year - modified_date.year ) * 12 + (Date.today.month - modified_date.month)
end
category "Ignoring directories" do
match { |file| File.directory?(file.name) }
You can’t perform that action at this time.