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
logs.view.map(_.takeWhile(_ != ' ')).grouped(8).count(_.contains("ERROR")) |
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 os | |
import subprocess | |
import boto.ec2 | |
import itertools | |
AWS_KEY = os.getenv('AWS_ACCESS_KEY') | |
AWS_SECRET = os.getenv('AWS_SECRET_KEY') | |
# Tweak as necessary for your infrastructure | |
regions = ['us-east-1', 'us-west-1', 'eu-west-1'] |
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
// Useful Scala Patterns for Compiler Design | |
// 1. Case Classes | |
// [For full details, see Programming in Scala 2ed, page 310] | |
// Case classes are syntactic sugar around normal Scala classes. They come prebaked with the following properties: | |
// * Factory constructor (don't need new) : | |
case class Foo(bar: 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
import other | |
def thrower(): | |
raise other.Exp1 | |
def catcher(): | |
try: | |
thrower() | |
except other.Exp1, other.Exp2: | |
pass |
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
..... | |
File "./filepicker/client/url_client.py", line 102, in get_file_info_response | |
url = urls_lib.sanitize_url(url, strict=True) | |
File "./filepicker/urls_lib.py", line 50, in sanitize_url | |
error() | |
File "./filepicker/urls_lib.py", line 38, in error | |
raise exceptions_lib.FilepickerException("Invalid Url", 400) | |
TypeError: 'AuthException' object is not callable |
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 exception_package | |
try: | |
thrower() | |
except exception_package.Exp1, exception_package.Exp2: | |
pass |
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
try: | |
thrower() | |
except NastyException, e: | |
print "Uh oh. We threw an", e |
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
try: | |
thrower() | |
except (Exception1, Exception2): | |
print DoStuff |
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
for (loop_cond) { | |
int x = 2; | |
if (x > 1) { | |
x = -5; | |
} | |
print(x); | |
} | |
// If we hoist x = 2, then we'll only print once | |
// If we don't we'll print every time. |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
[Ink setupWithAppKey:@"your-appkey-here"]; | |
/*Your app's intialization code here*/ | |
} |