Skip to content

Instantly share code, notes, and snippets.

@cjdell
cjdell / gist:3822fd330859fcc5aa0b
Created July 16, 2015 11:03
Strange indexOf issue with large arrays. Works in some runtimes and not others (node)
// Run this script with Node.js to see it throw. Works fine in browsers for some reason. Maybe an optimisation bug
function loop() {
var arr = [0];
var i = 0;
//eval('(1)'); // ==== UNCOMMENTING THIS MAKES IT WORK
while (i < 4101) { // ==== MAKING THIS SMALLER MAKES IT WORK
@cjdell
cjdell / main.c
Created February 2, 2016 17:42
ESP8266 + 433Mhz
//#include <Hash.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <RCSwitch.h>
const char* ssid = "Chris's ESP8266";
$fn = 100;
batt = [23, 72, 35];
standoff_spacing = 34;
standoff_diameter = 5.4;
standoff_radius = standoff_diameter / 2;
gate_thickness = 2.0;
gate_height = batt[2] / 2;
pole_radius = gate_thickness + standoff_radius;
$fn = 100;
LENGTH = 0;
WIDTH = 1;
HEIGHT = 2;
box_outer = [150, 50, 16];
wall_thickness = 2;
difference_bug_number = 2;
stupid_size = [100, 100, 100];
/**
* Could eventually be added to TSD, or to jsforce package root...
*/
declare module "jsforce" {
type Partial<T> = {
[P in keyof T]?: T[P];
};
class Connection {
@cjdell
cjdell / how-to-play.md
Last active October 29, 2021 15:05
Code Golf

How to play

Runtime

Node v8.11.1 with no context and strict mode enforced.

Your script

@cjdell
cjdell / exercism.md
Created June 7, 2017 14:30
Instructions for Exercism session
@cjdell
cjdell / Cylon.ino
Created July 19, 2017 14:48
Arduino LED Strip Samples
#include <NeoPixelBus.h>
#include <NeoPixelAnimator.h>
const uint16_t PixelCount = 8; // make sure to set this to the number of pixels in your strip
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
const RgbColor CylonEyeColor(HtmlColor(0x7f0000));
NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(PixelCount, PixelPin);
NeoPixelAnimator animations(2); // only ever need 2 animations
#include <NeoPixelBus.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
const uint16_t PixelCount = 163; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t RemotePin = 14; // make sure to set this to the correct pin, ignored for Esp8266
NeoPixelBus<NeoGrbFeature, NeoEsp8266Dma800KbpsMethod> strip(PixelCount, 2);
IRrecv remote(RemotePin);
@cjdell
cjdell / viewerframe.jsp
Created December 12, 2017 13:38
Sitedesk Viewer
<%--
* Copyright IBM Corporation 2009-2017
*
* Licensed under the Eclipse Public License - v 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing, software