Skip to content

Instantly share code, notes, and snippets.

View SIRHAMY's full-sized avatar
🐷
Loading...

Hamilton Greene SIRHAMY

🐷
Loading...
View GitHub Profile
@SIRHAMY
SIRHAMY / README.txt
Last active March 24, 2016 03:42
Sample bits of a custom striped Twitter Bootstrap progress bar
Sample code for a striped Twitter Bootstrap progressbar with stripes
See the codepen at: http://codepen.io/SIRHAMY/pen/zqwEwv
@SIRHAMY
SIRHAMY / progressbar.html
Created March 24, 2016 19:49
Dynamically change Twitter Bootstrap Progress Bar color with JQuery
<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>
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...")
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):
@SIRHAMY
SIRHAMY / SinglyLinkedListReverser.java
Created May 19, 2016 22:22
Simply Singly Linked List reverser in Java.
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
@SIRHAMY
SIRHAMY / requests_json.py
Created July 19, 2016 20:35
Access keys from requests module's JSON response
import requests
#initial request
r = requests.get(requestUrl)
#Extract JSON
rJson = r.json()
#Get keywords key from response JSON
keywords = rJson.get('keywords')
@SIRHAMY
SIRHAMY / example_schema.json
Created July 22, 2016 19:22
IBM Graph example schema
{
"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"}
@SIRHAMY
SIRHAMY / ibm_graphdb_gremlin_example.json
Created July 25, 2016 18:32
Example JSON object that can be used to run gremlin script on IBM's GraphDB
{
"gremlin": "def g = graph.traversal(); g.V(4208)"
}
@SIRHAMY
SIRHAMY / ibm_graphdb_vertex_creation_example.json
Created July 25, 2016 18:36
Example of JSON to create a new vertex in IBM's GraphDB
{ "label": "user",
"properties":
{
"name":"SIRHAMY",
"email": "[email protected]"
}
}
@SIRHAMY
SIRHAMY / USAGE.txt
Created July 25, 2016 21:50
IBM GraphDB - Update a vertex property, selecting vertex by vertex ID.
Here, you hit the vertex endpoint, supplying VERTEX_ID in the URL.
DOCUMENTATION: https://ibm-graph-docs.ng.bluemix.net/api.html#vertex-apis
Currently, something like:
-HTTP: POST
-URL: https://ibmgraph-alpha.ng.bluemix.net/$APIURL/$GRAPHNAME/vertices/$VERTEXID
-BODY: update_vertex_property.json