Skip to content

Instantly share code, notes, and snippets.

{
"currently": {
"apparentTemperature": 68.95,
"cloudCover": 0.18,
"dewPoint": 54.93,
"humidity": 0.61,
"icon": "clear-day",
"nearestStormBearing": 156,
"nearestStormDistance": 124,
"ozone": 338.39,
{
"authLastModifiedDate": "2014-08-16T19:11:54Z",
"authToken": "[redacted]",
"chargeRequestDate": null,
"chargeTime": "15 hrs 30 min ",
"chargeTime220": "5 hrs 30 min ",
"chrgDrtn22066Tx": "4 hrs 0 min ",
"class": "com.nissanusa.owners.VehicleCarwings",
"currentBattery": 4,
"currentCharging": "NOT_CHARGING",
#!/bin/bash
# Log in to Carwings web interface
curl --data "j_username=$LEAF_USERNAME&j_passwordHolder=Password&j_password=$LEAF_PASSWORD" -c cookiejar.tmp https://www.nissanusa.com/owners/j_spring_security_check
# Request a status update
curl -b cookiejar.tmp https://www.nissanusa.com/owners/vehicles/statusRefresh?id=$LEAF_CARID
# Download status JSON (sync, blocking)
curl -b cookiejar.tmp https://www.nissanusa.com/owners/vehicles/pollStatusRefresh?id=$LEAF_CARID
function *create() {
//this.body = yield render('submit', { referer: this.request.headers.referer, key: key || '' });
var results = yield db.query("INSERT INTO `posts` (bla, bla) VALUES (bla, bla)");
console.log(results);
this.response.end(); //redirect('/post/' + results[0][0].link);
}
#include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
int main(void) {
int ptr = 4;
int feelings = (ptr + 1) ? true : false;
var koa = require('koa');
var route = require('koa-route');
var serve = require('koa-static');
var db = require('./db');
var render = require('./render');
var app = koa();
app.use(serve('public/'));
@jaxbot
jaxbot / callback-equivalent.js
Last active August 29, 2015 14:05
Node.js generators vs. callbacks
function home() {
db.query("SELECT * FROM `posts` ORDER BY `time` DESC LIMIT 10", function(err, rows){
render('home', { posts: rows[0] }, function(err, result){
response.end(result);
});
});
}
function post(id) {
db.query("SELECT * FROM `posts` WHERE `link` = " + db.escape(id)), function(err, rows){
package main
import "fmt"
import "time"
func main() {
timestart := time.Now()
for c := 0; c < 100000000; c++ {
@jaxbot
jaxbot / example.com
Last active August 29, 2015 14:04
Example.com on Brighthouse (RoadRunner)
<!doctype html>
<html>
<head>
<title>Example Domain</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/Article">
<head>
<meta charset='utf-8'>
<title>Awesome Post</title>
<meta property="og:title" itemprop="name" content="Awesome Post" />
<meta property="og:image" itemprop="image" content="http://example.com/awesomeimage.jpg" />
<meta property="og:description" itemprop="description" content="This post is awesome" />
</head>