This file contains hidden or 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
| ######################### | |
| # .gitignore file for Xcode4 and Xcode5 Source projects | |
| # | |
| # Apple bugs, waiting for Apple to fix/respond: | |
| # | |
| # 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
| # | |
| # Version 2.6 | |
| # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
| # |
This file contains hidden or 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
| # taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
| # generate server.xml with the following command: | |
| # openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
| # run as follows: | |
| # python simple-https-server.py | |
| # then in your browser, visit: | |
| # https://localhost:4443 | |
| import BaseHTTPServer, SimpleHTTPServer | |
| import ssl |
This file contains hidden or 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
| def update(dl_url, force_update=False): | |
| """ | |
| Attempts to download the update url in order to find if an update is needed. | |
| If an update is needed, the current script is backed up and the update is | |
| saved in its place. | |
| """ | |
| import urllib | |
| import re | |
| from subprocess import call | |
| def compare_versions(vA, vB): |
This file contains hidden or 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
| import pygame, random, sys | |
| pygame.init() | |
| global screen, size, background, state, mainState, jumpState | |
| mainState = 0 | |
| jumpState = 1 | |
| slideState = 2 | |
| size = [800, 600] | |
| black = 0, 0, 0 | |
| white = 255, 255, 255 | |
| screen = pygame.display.set_mode(size) |
This file contains hidden or 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
| import Foundation | |
| /** | |
| * CGAffineTransform | |
| * | |
| * var a = CGAffineTransformMakeRotation(45.0 * M_PI / 180.0) | |
| * var b = CGPointMake(30.0, 43.3) | |
| */ | |
| /** |
This file contains hidden or 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
| // Playground - noun: a place where people can play | |
| import Cocoa | |
| enum Wildcard : NilLiteralConvertible { | |
| case Single | |
| case FromBeginning | |
| case ToEnd | |
| case Range(Int) | |
| case Literal(Int) |
This file contains hidden or 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
| {-# LANGUAGE DeriveFunctor, TemplateHaskell, GeneralizedNewtypeDeriving, FlexibleContexts #-} | |
| module Threads where | |
| import Control.Applicative | |
| import Control.Arrow | |
| import Control.Monad | |
| import Control.Monad.Except | |
| import Control.Monad.State.Class | |
| import Control.Monad.Trans | |
| import Control.Monad.Trans.Free |
This file contains hidden or 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
| func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String { | |
| let calendar = NSCalendar.currentCalendar() | |
| let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond | |
| let now = NSDate() | |
| let earliest = now.earlierDate(date) | |
| let latest = (earliest == now) ? date : now | |
| let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil) | |
| if (components.year >= 2) { | |
| return "\(components.year) years ago" |
This file contains hidden or 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 Main where | |
| import Prelude hiding ( | |
| iterate, repeat, map, filter, zipWith, zip, | |
| take, takeWhile, drop, dropWhile) | |
| import qualified Prelude as P | |
| import Text.Printf (printf) | |
| import Data.List (intercalate) | |
| infixr 5 :> |
This file contains hidden or 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
| {-# LANGUAGE GADTs, ConstraintKinds, KindSignatures, DeriveDataTypeable #-} | |
| {-# LANGUAGE TypeOperators, ScopedTypeVariables, FlexibleInstances #-} | |
| module Shape where | |
| import Control.Applicative ((<$>), (<|>)) | |
| import Data.Maybe (mapMaybe) | |
| import Data.Typeable | |
| import GHC.Exts (Constraint) | |
OlderNewer