Skip to content

Instantly share code, notes, and snippets.

@thequbit
thequbit / gist:b0fc7a025d98414e2d291e8ed33648b2
Created March 31, 2018 02:57
json contents replace help
You currently have ...
componentDidMount() {
fetch(API).then(
response => response.json()
).then(
data => this.setState(
{
quotes: data
}
def u8s_to_i16(low_u8, high_u8):
# get the high byte without the top bit ( sign bit )
high_byte = high_u8 & 127
# get the sign bit as a 1 ( negative ) or a 0 ( possitive )
high_byte_sign = (high_u8 & 128) >> 7 # get top bit
# get the low byte ( no adjustments needed )
low_byte = low_u8
# read the bytes from the I2C device
eight8 = bus.read_byte_data(address, 0x88)
eight9 = bus.read_byte_data(address, 0x89)
# get the high byte without the top bit ( sign bit )
high_byte = eight9 & 127
# get the sign bit as a 1 ( negative ) or a 0 ( possitive )
high_byte_sign = (eight9 & 128) >> 7 # get top bit
thequbit@tim-thinkpad-t550:~/dev/hhroc/yellr-server/website$ npm install
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/autoprefixer
npm http GET https://registry.npmjs.org/cssnano
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/grunt-banner
npm http GET https://registry.npmjs.org/grunt-contrib-concat
npm http GET https://registry.npmjs.org/grunt-contrib-copy
npm http GET https://registry.npmjs.org/grunt-contrib-jade
{
"posts": [
{
"has_voted": false,
"language_code": "en",
"contents": "This is a test post!",
"lat": 43.1,
"assignment": {},
"is_up_vote": false,
"id": "72833379-fb27-4471-af08-758e3437be3f",
POST to /api/post with the following json as the body of the document
{
"assignment_id": null, ( or the assignment id )
"contents": "this is the text contents of my post!"
}
POST to /api/media_objects as a form submit ( as we had been doing before )
media_type = audio|video|image
{
"client": {
"creation_datetime": "2015-10-24 18:05:32",
"last_lat": 43.1,
"verified": false,
"email": "",
"platform": "test",
"verified_datetime": "None",
"cuid": "43c4e9c0-bb48-4cde-ad5a-00f24b43dbfc",
"last_lng": -77.5,
{
"assignments": [
{
"bottom_right_lng": -77.3,
"top_left_lng": -77.9,
"id": "1ecec874-74a9-4903-b418-0cedd14c788a",
"creation_datetime": "2015-10-24 17:49:11",
"name": "Test Assignment",
"bottom_right_lat": 43.0,
"questions": [
{
"posts": [
{
"lng": -77.1,
"has_voted": false,
"assignment": null,
"down_count": 0,
"contents": "This is a test post!",
"up_count": 0,
"approved": true,
{
"posts": [
{
"deleted": false,
"id": "1eaf645f-99ed-4ea0-ba2c-2c0be5faf09b",
"language_code": "en",
"down_count": 0,
"assignment": null,
"creation_datetime": "2015-10-24 03:45:16",
"lng": -77.1,