Skip to content

Instantly share code, notes, and snippets.

View chico's full-sized avatar

Chico Charlesworth chico

View GitHub Profile
@chico
chico / MainActivity.java
Created March 22, 2018 11:49
CIFAR_10 Android Fix for Mammoth Interactive's Mobile Learning course
private float[] formatImageData() {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imageResouceIds[imageArrayIndex]);
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, 32, 32, true);
int[] intArray = new int[1024];
scaledBitmap.getPixels(intArray, 0, 32, 0, 0, 32, 32);
float[] floatArray = new float[3072];
int n = 0;
for (int i = 0; i < 1024; i++) {
floatArray[n++] = ((intArray[i] >> 16) & 0xff) / 255.0f;
floatArray[n++] = ((intArray[i] >> 8) & 0xff) / 255.0f;
var result = {ok: true};
console.dir(result, {depth: null, colors: true});
passport.use(new MailChimpStrategy({
clientID: config.auth.mailchimpAuth.clientID,
clientSecret: config.auth.mailchimpAuth.clientSecret,
callbackURL: config.auth.mailchimpAuth.callbackURL,
passReqToCallback : true
},
function(req, token, refreshToken, profile, done) {
token = token + '-' + profile.dc; // Append datacenter to token for API calls to work
// Save and use token for doing Mailchimp API calls
}
@chico
chico / switch.css
Last active September 7, 2016 11:05
.onoffswitch {
position: relative; width: 90px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
border: 1px solid red; border-radius: 20px;
Verifying that +ccharlesworth is my blockchain ID. https://onename.com/ccharlesworth
/********************************************************
* PID Basic Example
* Reading analog input 0 to control analog PWM output 3
********************************************************/
#include <PID_v1.h>
#define PIN_INPUT 0
#define PIN_OUTPUT 3
@chico
chico / robotarm.js
Last active December 14, 2015 22:11
var five = require('johnny-five')
var board = new five.Board()
var moveBase = function(board, base, cb) {
base.to(10, 2000)
board.wait(2500, function () {
base.to(170, 3000)
board.wait(3500, function () {
@chico
chico / MainActivity
Created October 31, 2014 10:28
GPUImage.saveToPictures blocks UI with preview
// in onCreate()
glSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView);
mGPUImage = new GPUImage(this);
mGPUImage.setGLSurfaceView(glSurfaceView);
// on user button click
mCamera.mCameraInstance.takePicture(null, null, new Camera.PictureCallback() {

Keybase proof

I hereby claim:

  • I am chico on github.
  • I am chico (https://keybase.io/chico) on keybase.
  • I have a public key whose fingerprint is CDAD ED2F 12B0 B6E3 6109 1525 4F96 6D26 7A52 0B0F

To claim this, I am signing this object:

#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end