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
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=frame-nopass.pdf -c .setpdfwrite -f frame.pdf |
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
#standard deviation | |
data=[3,3,3,3,3] | |
mean=3 | |
dataminus=[(each-mean)**2 for each in data] | |
variance= sum(dataminus)/len(data) | |
print dataminus | |
print variance | |
print variance**.5 | |
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
#standard deviation | |
data=[0,1] | |
mean=(sum(data)+.0000)/len(data) | |
dataminus=[(each-mean)**2 for each in data] | |
variance= sum(dataminus)/len(data) | |
#print dataminus | |
print "this is the varience" | |
print variance | |
print "this is the standard div" |
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
let altStringToSearch:NSString = "I want to make a cake and then prepare coffee" | |
let altSearchTerm:NSString = "cake" | |
let altScanner = NSScanner(string: altStringToSearch) | |
var altResult:NSString? | |
altScanner.scanUpToString(altSearchTerm, intoString:&altResult) | |
println(altResult!) |
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
import UIKit | |
//TO DO: Need to add third pass to check if words to be replaced overlap. Larger numbers take precedence. | |
//Swift-ify Inflationary English | |
extension Array { | |
func contains<T : Equatable>(obj: T) -> Bool { | |
let filtered = self.filter {$0 as? T == obj} |
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 python | |
# | |
# Extracts email addresses from one or more plain text files. | |
# | |
# Notes: | |
# - Does not save to file (pipe the output to a file if you want it saved). | |
# - Does not check for duplicates (which can easily be done in the terminal). | |
# | |
# (c) 2013 Dennis Ideler <ideler.dennis@gmail.com> |
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
// Public domain. | |
// Free to use. | |
// Use like this: | |
var world = "Hello, world!" | |
let convertedRange = world.convertRange(0..<5) | |
world.removeRange(convertedRange) | |
// Converts a regular range (0..5) to a proper String.Index range. | |
extension 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
// Playground - noun: a place where people can play | |
import UIKit | |
// Setup the calendar object | |
let calendar = NSCalendar.currentCalendar() | |
// Set up date object | |
let date = NSDate() |
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
import json | |
import urllib2 | |
pythonParsedList = json.load(urllib2.urlopen('https://raw.githubusercontent.com/exercism/xpython/master/config.json')) | |
swiftParsedList = json.load(urllib2.urlopen('https://raw.githubusercontent.com/exercism/xswift/master/config.json')) | |
haskellParsedList = json.load(urllib2.urlopen('https://raw.githubusercontent.com/exercism/xhaskell/master/config.json')) | |
csharpParsedList = json.load(urllib2.urlopen('https://raw.githubusercontent.com/exercism/xcsharp/master/config.json')) | |
#Python |
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
extension String { | |
var isEmptyOrWhiteSpace:Bool { get { | |
return self.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()).isEmpty | |
}}} |
OlderNewer