Skip to content

Instantly share code, notes, and snippets.

View joshperry's full-sized avatar
😝

Joshua Perry joshperry

😝
View GitHub Profile
@joshperry
joshperry / gist:b32559be5a2e05d51c53
Created October 8, 2014 21:43
HTTP client proxy
var http = require('http'),
EventEmitter = require('event').EventEmitter,
httpProxy = require('http-proxy');
var proxyAgent = new http.Agent({ maxSockets: 3 });
proxyAgent.createConnection = function(options) {
var clientSocket = registry.getSocket(options.servername);
if(!clientSocket) {
// Set clientSocket to a future Socket here somehow
@joshperry
joshperry / gist:9e3e35e10094746ecb0a
Last active August 29, 2015 14:11
Pumping an event stream using Promises
var network = getNetworkSystem();
var io = initWebsockets();
var waitForNodes = function(reject) {
return network.onNodeIdentification()
.then(function(nodeId) {
io.emit('node found', nodeId);
}, reject)
.then(waitForNodes.bind(this, reject));
};
$('.level1>.x-panel-bwrap>.x-panel-tbar, .level2>.x-panel-bwrap>.x-panel-tbar, .level3>.x-panel-bwrap>.x-panel-tbar').click(function(){
parent = this.parentNode;
body = $(parent).children('.x-panel-body');
xpanel = $(body).children('.x-panel');
// I always specifically open and close because I've seen some issues with toggleClass. - CM
if($(this).hasClass('open')) {
$(this).removeClass('open');
$(xpanel).removeClass('open');
} else {
$(this).addClass('open');
@joshperry
joshperry / rollOnLoad.js
Created April 3, 2015 18:26
Roll on load directive
angular.module('saidpApp')
.directive('rollOnLoad', function(){
return {
restrict: 'A',
link: function(scope,element){
element.addClass('preroll');
setTimeout(function() {
requestAnimationFrame(function() {
element.removeClass('preroll');
});
var Promise = require('bluebird');
var someAsyncFunction = Promise.promisify(someFunction);
function one() {
return someAsyncFunction(params)
.then(function one(results) {
console.log('one');
});
}
@joshperry
joshperry / _grid.scss
Last active September 15, 2015 22:44 — forked from auniverseaway/_grid.scss
Flexbox Grid System
@mixin grid($count) {
display: flex;
// Add Gutters
&.Gutter {
margin: -1em 0 0 -1em;
>.Cell {
padding: 1em 0 0 1em;
}
$dropdown-transition-duration: 200ms;
@mixin pdk-transition($duration, $type) {
-webkit-transition: all $duration $type;
-moz-transition: all $duration $type;
-o-transition: all $duration $type;
transition: all $duration $type;
}
@mixin profilemenu-animate($height, $width, $border-color:gainsboro, $box-shadow-color: #e6e6e6){
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var sourceMaps = require('gulp-sourcemaps'),
path = require('path');
gulp.task('styles', function() {
var designBase = 'src/main/resources/jcr_root/etc/slick/designs/';
gulp.src('**/scss/*.scss', { base: designBase })
.pipe(sourceMaps.init())

Carwings JSON API Protocol

This protocol is a much simpler interface to the Carwings telematics information. The original protocol was an XML SOAP API and was a bit of a pain to work with.

Every operation is executed as a simple HTTP GET request and responds with JSON documents. Parameters for the operation are encoded on the querystring.

The only operation that requires any kind of credentials is the User Login operation. All other operations take the DCMID and the VIN of your vehicle as parametersfor authorizing the requested operation.

All of the responses documents have a message and status property to signal operation success/failure messages and status. The status seems to mirror the HTTP reponse code and message seems to be "success" for successful operations.

// Definitions for SC16IS750 UART on spi0.0
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
/* disable spi-dev for spi0.0 */
fragment@0 {
target = <&spi0>;
__overlay__ {