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
{ | |
"propertyKeys": [ | |
{"name": "name", "dataType": "String", "cardinality": "SINGLE"}, | |
{"name": "verified", "dataType": "Boolean", "cardinality": "SINGLE"}, | |
{"name": "tweet", "dataType": "String", "cardinality": "SINGLE"}, | |
{"name": "sentiment", "dataType": "String", "cardinality": "SINGLE"}, | |
{"name": "tone", "dataType": "String", "cardinality": "SINGLE"}, | |
{"name": "hashtag", "dataType": "String", "cardinality": "SINGLE"}, | |
{"name": "numTimes", "dataType": "Integer", "cardinality": "SINGLE"}, | |
{"name": "time", "dataType": "String", "cardinality": "SINGLE"} |
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 requests | |
#initial request | |
r = requests.get(requestUrl) | |
#Extract JSON | |
rJson = r.json() | |
#Get keywords key from response JSON | |
keywords = rJson.get('keywords') |
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
public class Reverser { | |
public Node reverseSLL(Node head) { | |
//To reverse: | |
//A -> B -> C | |
//A <- B <- C | |
//Save B's pointer to C | |
//Set B's pointer to A/where we came from | |
//Save pointer to B |
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 time | |
import tweetpony | |
self.twitAPI = tweetpony.API(consumer_key = env.TWITTER_CONSUMER_KEY, | |
consumer_secret = env.TWITTER_CONSUMER_SECRET, | |
access_token = env.TWITTER_ACCESS_TOKEN_KEY, | |
access_token_secret = env.TWITTER_ACCESS_TOKEN_SECRET) | |
#Abstract minefeed so you can recall it if there's an error | |
def mineFeed(self, twitterID): |
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 json | |
#This is going to fetch our lines one-by-one | |
#Useful for super-huge files | |
class JSONFetcher(): | |
def __init__(self, fileName): | |
self.fileName = fileName + '.json' | |
def fetch(self): | |
print("fetching...") |
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
<div id="progressbar" | |
class="progress-bar progress-bar-custom | |
progress-bar-striped-custom" | |
role="progressbar" | |
aria-valuenow="70" aria-valuemin="0" | |
aria-valuemax="100" style="width: 70%;"> | |
Progress Bar Text | |
</div> |
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
Sample code for a striped Twitter Bootstrap progressbar with stripes | |
See the codepen at: http://codepen.io/SIRHAMY/pen/zqwEwv |
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
td { | |
vertical-align: bottom; | |
} |
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
Eigen::Quaterniond myQuaternion; //This is the quaternion we want to store the result in | |
//These are the two quaternions we'll be adding together | |
Eigen::Quaterniond q1 = initializeMyQuaternion(exampleParam); //We'll say it initializes to some random, valid vals | |
Eigen::Quaterniond q2 = initializeMyQuaternion(exampleParam2); | |
//Perform the addition | |
myQuaternion.w() = q1.w() + q2.w(); //Add the scalar portion | |
myQuaternion.vec() = q1.vec() + q2.vec(); //Add the vector portion |
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
Eigen::Quaterniond MyWorld::quatMult(Eigen::Quaterniond q1, Eigen::Quaterniond q2) { | |
Eigen::Quaterniond resultQ; | |
resultQ.setIdentity(); | |
resultQ.w() = q1.w() * q2.w() - q1.vec().dot(q2.vec()); | |
resultQ.vec() = q1.w() * q2.vec() + q2.w() * q1.vec() + q1.vec().cross(q2.vec()); | |
return resultQ; | |
} |