Skip to content

Instantly share code, notes, and snippets.

James Waples jamwaffles

Block or report user

Report or block jamwaffles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View esp8266_0v25_fixed.js
/* Copyright (c) 2015 Gordon Williams, Pur3 Ltd. Modified by James Waples 2018 */
/*
Library for interfacing to the EspressIF ESP8266. Uses the 'NetworkJS'
library to provide a JS endpoint for HTTP.
For EspressIF ESP8266 firmware 0.25
*/
var at;
var socks = [];
View CodeSchoolEspruino1.js
SPI1.setup({ baud:3200000, mosi: A7 });
var brightness = 0;
var delta = 1;
var maxBrightness = 250;
var numLeds = 12;
var data = new Uint8ClampedArray(numLeds * 3);
function sendFrame(data) {
@jamwaffles
jamwaffles / class.rs
Created Aug 13, 2015
Rust "class" definition
View class.rs
struct Sprite {
image_data: SomeBinaryType,
width: i16,
height: i16
}
impl Sprite {
pub fn new(filename: str) -> Sprite {
// TOOD: Load image into a Piston/OpenGL texture
View gist:c66a727287ef01ef10f5
var s3 = require('gulp-s3');
var gzip = require('gulp-gzip')
gulp.task('s3-gzip', function() {
var assetsConf = {
key: "YOURAWSKEYHERE",
secret: "sTuPiDLongS3CretKey",
region: 'eu-west-1',
bucket: 'bucketName'
}
View fuckYouJquery.js
Backbone.$ = function(el) {
return {
on: function(eventName, handler) {
el.addEventListener(eventName, handler)
},
off: function() {
console.error("`off` isn't implemented. If you need to use this, implement it or you'll get memory leaks")
}
}
@jamwaffles
jamwaffles / MergeGUI.md
Last active Aug 29, 2015
Graphical merge tool for resolving Git merge conflicts
View MergeGUI.md

Diff screenshot

Installation

  1. Download DiffMerge from here. It's not the prettiest merge tool but it works.

  2. Install it as usual

  3. Open up a console and run the following commands:

     git config --global merge.tool diffmerge
     git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"'
    
@jamwaffles
jamwaffles / gist:4376dcda7644846543db
Last active Aug 29, 2015
tm-react-accordion howto
View gist:4376dcda7644846543db
var React = require('react')
var Accordion = require('tm-react-accordion').Accordion
var Item = require('tm-react-accordion').Item
var AccordionHeader = require('tm-react-accordion').Header
var AccordionContent = require('tm-react-accordion').Content
React.renderComponent(
<Accordion className="custom-accordion-class">
<Item open={true} className="custom-item-class">
View ImgurAPI.php
<?php
namespace Model;
use RedBean_Facade as R;
class ImgurAPI extends \Pliers\Model {
protected $user;
protected $session;
public function __construct() {
View server.js
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html');
});
app.use('/public', express.static(__dirname + '/public'));
View jquery.fadeslide.js
/*
* jQuery fade/slide plugin to toggle/show/hide an element by fading then sliding it in/out
* If given new content, it will automatically refit itself, and show it
*
* By James Waples 2013
*
* Usage:
*
* $('.selector').fadeSlide('fast', function() { ... }) // Toggle, fast, run callback anonymous function
* $('.selector').fadeSlide(650, 'hide') // Fade out, slide hide in 650 msec
You can’t perform that action at this time.