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
use std::io::prelude::*; | |
use std::net::{TcpListener, TcpStream}; | |
use std::io::BufReader; | |
use std::thread; | |
use std::fs::File; | |
fn get_definitions(word: String) -> Vec<String>{ | |
let mut dict = File::open("dict.txt").unwrap(); | |
let mut reader = BufReader::new(dict); | |
let mut matches: Vec<String> = Vec::new(); |
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
//! Leveraging tuples to make a statically typed, concatenative EDSL in Rust. | |
//! | |
//! I'm not sure how practical it really is – Rust's syntax can make it a little | |
//! hard to read, but it's fun to play around with it. The neat thing is how | |
//! little copying occurs. Everything is moved in and out by-value in a pipeline. | |
//! | |
//! Thanks goes to [Tekmo on reddit](http://www.reddit.com/r/programming/ | |
//! comments/1zzom4/using_functionlength_to_implement_a_stack_language/cfyibsr) | |
//! for the idea. | |
//! |
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
operator infix ^= { | |
} | |
operator infix *= { | |
} | |
operator infix * { | |
} | |
operator infix % { |
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
#!/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -i -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk | |
import Foundation | |
class JSON { | |
struct Path: Printable { | |
enum Element { | |
case Index(Int) | |
case Key(String) |
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.Drawing; | |
using MonoTouch.CoreGraphics; | |
using MonoTouch.UIKit; | |
using MonoTouch.Foundation; | |
using MonoTouch.ObjCRuntime; | |
/** | |
* Copyright (c) 2014 Jon Lipsky |
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
// | |
// ViewController.swift | |
// Tetris | |
// | |
// Created by Julius Parishy on 11/19/14. | |
// Copyright (c) 2014 Julius Parishy. All rights reserved. | |
// | |
import 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
class Client < Android::OS::AsyncTask | |
def doInBackground(params) | |
url = Java::Net::URL.new("http://www.bom.gov.au/fwo/IDN60901/IDN60901.94768.json") | |
reader = Java::IO::BufferedReader.new(Java::IO::InputStreamReader.new(url.openStream)) | |
builder = Java::Lang::StringBuilder.new("") | |
while ((line = reader.readLine()) != nil) do | |
builder.append(line) | |
end | |
puts builder.toString |
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
class NSObject | |
def self.with(args = {}) | |
args.count == 0 ? method = "init" : method = "initWith" | |
objc_args = [] | |
args.each do |a| | |
a[0] = a[0][0].capitalize + a[0][1..-1] if objc_args.size < 1 | |
method << a[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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'osx/cocoa' | |
app = OSX::NSApplication.sharedApplication | |
window = OSX::NSWindow.alloc.initWithContentRect_styleMask_backing_defer( | |
[0,0,500,500], | |
OSX::NSTitledWindowMask + OSX::NSClosableWindowMask, |
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
delegate = Object.new | |
def delegate.netServiceBrowserWillSearch(browser) | |
puts "search commencing!" | |
end | |
def delegate.netServiceBrowser(browser, didFindService:service, moreComing:more) | |
# this never calls regardless of the services on the network. | |
puts "Found service #{service.name}." | |
end |
OlderNewer