Writing a test gist to check gist.io appearance.
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
| class MyDecorator(object): | |
| def __init__(self, f): | |
| print "inside init {0}".format(f.__name__) | |
| f() | |
| def __call__(self): | |
| print "inside call {0}".format(__name__) | |
| @MyDecorator |
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
| from sqlalchemy.dialects import registry | |
| from sqlalchemy.engine import reflection | |
| from sqlalchemy.connectors.pyodbc import PyODBCConnector | |
| from sqlalchemy.dialects.postgresql.base import ( | |
| PGDialect, PGTypeCompiler, PGCompiler, PGDDLCompiler, DOUBLE_PRECISION, | |
| INTERVAL, TIME, TIMESTAMP) | |
| from sqlalchemy import MetaData | |
| import sqlalchemy.types as sqltypes | |
| from sqlalchemy.schema import SchemaItem | |
| from sqlalchemy.sql import Select, text, bindparam |
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
| groupBy('source) { | |
| _.sortBy('links) | |
| .reverse | |
| .mapStream[(String,Int), (String, Int, Int, Int)] | |
| (('destination, 'links) -> ('destination, 'links, 'rank, 'gap)) { destLinks => | |
| destLinks.scanLeft(None: Option[(String, Int, Int, Int)]) { | |
| (prevRowOut: Option[(String,Int,Int,Int)], thisRow: (String, Int)) => | |
| val (dest, links) = thisRow | |
| prevRowOut match { | |
| case None => Some((dest, links, 1, 0)) // rank 1, gap 0 -- not exactly what you wanted... |
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
| function youtube(){ | |
| // Setup OAuthServiceConfig | |
| var oAuthConfig = UrlFetchApp.addOAuthService("youtube"); | |
| oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken"); | |
| oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope=http%3A%2F%2Fgdata.youtube.com%2F"); | |
| oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken"); | |
| oAuthConfig.setConsumerKey("anonymous"); | |
| oAuthConfig.setConsumerSecret("anonymous"); | |
| // Setup optional parameters to point request at OAuthConfigService. The "twitter" |
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
| #!/usr/bin/perl | |
| my %grades; | |
| while (<>){ | |
| chomp; | |
| ($lname, $fname, $asm, $score) = split(/,/); | |
| if (exists $grades{$lname}){ | |
| $grades{$lname}{$asm} = $score; | |
| }else{ | |
| $grades{$lname} = {"firstname" => $fname, $asm => $score}; |
NewerOlder