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 pyspark | |
class Point(object): | |
'''this class being used as container''' | |
pass | |
def to_point_obj(point_as_dict): | |
'''convert a dict representation of a point to Point object''' | |
p = Point() | |
p.x = point_as_dict['x'] |
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
chandank@PRINHYLTPHP0314:~/workspace/pandas-cookbook/cookbook$ sudo pip install -U rpy2 | |
[sudo] password for chandank: | |
Downloading/unpacking rpy2 | |
Downloading rpy2-2.3.10.tar.gz (187kB): 187kB downloaded | |
Running setup.py (path:/tmp/pip_build_root/rpy2/setup.py) egg_info for package rpy2 | |
sh: 1: R: not found | |
Error: Tried to guess R's HOME but no R command in the PATH. | |
Complete output from command python setup.py egg_info: | |
running egg_info |
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/python2 | |
""" | |
This script automates the task of connecting to a running App Engine server, | |
whether it's a local dev_appserver or a live app. | |
If PyQt4 is installed, it will ask for credentials inside a dialog box | |
instead of prompting in the terminal. This is good for shells that do | |
not support getpass (iPython). | |
It will automatically add an import path for a local virtualenv in the app |
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
def fact(n): | |
""" | |
Computes factorial. | |
>>> fact(1) | |
1 | |
>>> fact(5) | |
120 | |
>>> fact(-1) # doctest: +IGNORE_EXCEPTION_DETAIL | |
Traceback (most recent call last): |
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
$http.post('/campaignauth', payload).success(function(data) { | |
console.log(data); | |
if (data.response.status == 'error') { | |
//display alert to user | |
} else { | |
// $cookieStore.put("AMBC_SSID", data.response.token); | |
// The below code is intentionally set to run after a | |
// small delay due to cookie not being set by the time | |
// the location path changes. Better way to fix this | |
// is to set the cookie manually, as shown above, but |
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
contract OrganisationInterface | |
{ | |
function setDataStore(address _tokenLedger, address _eternalStorage); | |
function addProposal(bytes32 _name); | |
function proposalsCount() constant returns (uint256); | |
function getProposal(uint256 _id) constant returns (bytes32 _name, uint256 _eth); |
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 "OrganisationInterface.sol"; | |
import "TokenLedger.sol"; | |
import "EternalStorage.sol"; | |
import "SecurityLibrary.sol"; | |
contract Parent { | |
event OrganisationCreated(address organisation, uint now); | |
event OrganisationUpgraded(address organisation, uint now); |
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 "ITokenLedger.sol"; | |
import "ProposalsLibrary.sol"; | |
import "SecurityLibrary.sol"; | |
import "DataVerifiable.sol"; | |
contract Organisation is DataVerifiable | |
{ | |
ITokenLedger public tokenLedger; | |
using ProposalsLibrary for address; | |
using SecurityLibrary for address; |
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
def largest_num(nums): | |
""" | |
Form the largest number by joining the given list of numbers. | |
>>> largest_num([0]) | |
0 | |
>>> largest_num([1, 2, 0]) | |
210 | |
>>> largest_num([1, 10, 100]) | |
110100 |
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
var options = { | |
nodes: { | |
shape: "dot", | |
scaling: { | |
customScalingFunction: function(min, max, total, value) { | |
return value / total; | |
}, | |
min: 5, | |
max: 150 | |
} |
OlderNewer