Skip to content

Instantly share code, notes, and snippets.

View AlexJWayne's full-sized avatar
🌈

Alex Wayne AlexJWayne

🌈
View GitHub Profile
class Money
def evenly_divided(parts)
extra = cents % parts
(0...parts).map do |i|
add1 = i < extra ? 1 : 0
Money.from_cents cents / parts + add1
end
end
end
#define SENSOR_START_INDEX 4
#define SENSOR_END_INDEX 8
void loop() {
bool sensorIsTripped = readFromSensor();
for (var i = 0; i < NUM_LEDS; i++) {
if (sensorIsTripped && i >= SENSOR_START_INDEX && i < SENSOR_END_INDEX) {
leds[i] = CGRB::Green;
} else {
var Eggbot, SerialPort;
SerialPort = require("serialport").SerialPort;
Eggbot = (function() {
function Eggbot(serialPath, onReady) {
this.shaftAngle = 0;
this.armAngle = 0;
this.serial = new SerialPort(serialPath);
this.serial.open(function(error) {
Process: kicad [1510]
Path: /usr/local/Cellar/kicad/HEAD/kicad.app/Contents/MacOS/kicad
Identifier: org.kicad-eda.kicad
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: kicad [1510]
User ID: 501
Date/Time: 2015-01-19 11:23:02.763 -0800
» brew install kicad --HEAD
==> Installing kicad from metacollin/homebrew-kicad
==> Installing dependencies for kicad: boost, pcre, swig, kicad-library
==> Installing kicad dependency: boost
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/boost-1.57.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring boost-1.57.0.yosemite.bottle.tar.gz
🍺 /usr/local/Cellar/boost/1.57.0: 10572 files, 439M
==> Installing kicad dependency: pcre
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pcre-8.36.yosemite.bottle.tar.gz
/Applications/KiCad/build
» make
[ 0%] Built target boost
[ 35%] Built target bitmaps
[ 35%] Built target page_layout_lexer_source_files
[ 35%] Built target netlist_lexer_source_files
[ 35%] Built target lib-dependencies
[ 43%] Built target common
[ 43%] Built target fp_lib_table_lexer_source_files
[ 43%] Generating headers containing GLSL source code
/Applications/KiCad/build
» cmake ../kicad \
> -DCMAKE_C_COMPILER=clang \
> -DCMAKE_CXX_COMPILER=clang++ \
> -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 \
> -DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
> -DKICAD_SCRIPTING=OFF \
> -DKICAD_SCRIPTING_MODULES=OFF \
> -DKICAD_SCRIPTING_WXPYTHON=OFF \
> -DCMAKE_INSTALL_PREFIX=../bin \
#include "FastLED.h"
#define NUM_LEDS 12
#define DATA_PIN 3
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_LEDBackpack.h"
// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_GFX.h"
#include "neopixel/neopixel.h"
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
import UIKit
var s: NSString = "asd"
var searchText: NSString = "a"
func myFunc() -> NSRange{
var range = s.rangeOfString(searchText, options: .CaseInsensitiveSearch)
return s.rangeOfString(searchText, options: .CaseInsensitiveSearch)
}