Skip to content

Instantly share code, notes, and snippets.

Natasha Murashev NatashaTheRobot

View GitHub Profile
@NatashaTheRobot
NatashaTheRobot / StoryboardController.swift
Created Apr 9, 2016 — forked from garohussenjian/SegueInteractor.swift
Bind Swift closure to StoryboardSegues (Master-Detail example)
View StoryboardController.swift
// StoryboardController.swift
// SegueIdentifier enumerates just the segue ID strings in the storyboard. VC's don't switch on this one...
enum SegueIdentifier: String {
case ShowDetail
}
// SegueInteractor binds closures to segues. VC's can switch on this instead!
enum SegueInteractor {
case ShowDetail((EventEntity) -> Void)
View currency.swift
import Foundation
protocol Currency { static var sign: String { get } }
enum GBP: Currency { static let sign = "£" }
enum EUR: Currency { static let sign = "" }
enum USD: Currency { static let sign = "$" }
protocol _Money {
associatedtype C: Currency
var amount: NSDecimalNumber { get }
View WatchConnectivitySingletonDemo.swift
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
View Person_v4.swift
protocol AgeClasificationProtocol {
var age: Int { get }
func agetype() -> String
}
class Person {
var firstname: String
var lastname: String
var age: Int
View psql
development:
adapter: postgresql
encoding: unicode
database: url_development
pool: 5
username: jd
password:
host: localhost
port: 5432
View gameoflife.html
<!DOCTYPE html>
<html lang='en'>
<head>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type=text/javascript src="/game.js"></script>
<meta charset="UTF-8">
<link rel="stylesheet" href="game.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
View typhoeus.rb
#https://dev.twitter.com/docs/api/1/get/search
require 'Typhoeus'
require 'JSON'
url = 'http://api.twitter.com/search.json?q=dev+bootcamp&rpp=5&include_entities=true&result_type=mixed'
response = Typhoeus::Request.get(url)
p all_tweets = JSON.parse(response.body)
@NatashaTheRobot
NatashaTheRobot / dictionary.html
Created Jun 13, 2012
Working with Javascript Hashes
View dictionary.html
<script>
var english = {
house: "A building for human habitation",
tree:"A woody perennial plant",
street: "A public road in a city or town"
};
var americanEnglish = Object.create(english, {
elevator: "A platform or compartment housed in a shaft for raising and lowering people or things to different floors or levels",
@NatashaTheRobot
NatashaTheRobot / timeformattingRuby
Created Dec 12, 2011
Format Time To Today At Midnight GMT In Ruby
View timeformattingRuby
require 'time'
#convert today's time to a string
today = Time.now.to_s # => "Mon Dec 12 10:52:45 -0800 2011"
#replace the hours:minutes:seconds and time-zone to the time and time zone that you need
today[11, 14] = "00:00:00 +0000" # => "Mon Dec 12 00:00:00 +0000 2011"
#convert the time string back into time format
Time.parse(today) # => Sun Dec 11 16:00:00 -0800 2011 - The time is adjusted for my time-zone (-0800), but it is equivalent to midnight in GMT time (Mon Dec 12 00:00:00 +0000 2011)
@NatashaTheRobot
NatashaTheRobot / YahtzeeSolution
Created Nov 23, 2011
This is the solution to Stanford CS106A Yahtzee Assignment 5
View YahtzeeSolution
/*
* File: Yahtzee.java
* ------------------
* This program will eventually play the Yahtzee game.
*/
import acm.io.*;
import acm.program.*;
import acm.util.*;
import java.util.*;
You can’t perform that action at this time.