Skip to content

Instantly share code, notes, and snippets.

View debreuil's full-sized avatar

Robin Debreuil debreuil

View GitHub Profile
@debreuil
debreuil / pita.js
Created May 6, 2013 05:39
Oh Javascript...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script>
// need to manually set re.lastIndex = 0; or this happens
var s1 = "bc11bc22f";
var s2 = "bc33bc44g";
var re = /.*?(bc..)/g;
var result1 = re.exec(s1);//bc11
var result2 = re.exec(s2);//bc44
@debreuil
debreuil / WordGrid.as
Created May 5, 2013 04:53
Four letter word encodings
package Core
{
public class WordList
{
private static var _instance:WordList;
public function WordList()
{
}
public static function getInstance():WordList
@debreuil
debreuil / gist:1306291
Created October 22, 2011 17:59
state change example
package Managers
{
import Animation.*;
import DDW.Managers.StateManager;
import DDW.Managers.StateObject;
import Screens.*;
import flash.display.Sprite;
@debreuil
debreuil / servos.c
Created August 31, 2011 05:02
7 servos and ADC running on MSP430 LaunchPad
/*
Freeware. source [email protected]
ADC pin: P1.0
PWM signal pin: P1.2
ADC signal is just a light sensor with a 1K resistor to 3.3V
*/
/*
Freeware. source [email protected]
ADC pin: P1.0
PWM signal pin: P1.2
ADC signal is just a light sensor with a 1K resistor to 3.3V
*/
@debreuil
debreuil / b2d JSFL
Created March 1, 2011 08:29
first step in parsing points for box2d
fl.outputPanel.clear();
var trace = fl.trace;
fl.showIdleMessage(false);
var doc = fl.getDocumentDOM();
var tl = fl.getDocumentDOM().getTimeline();
var firstGuideLayer = null;
function main()
{
var guideLayers = getGuideLayers();
@debreuil
debreuil / papilioAnimatedLEDs.VHD
Created February 27, 2011 05:57
VHDL Papilio LED animation - pattern, speed, direction
-- File: Blink.VHD -------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Blink is
Port (
PB : in STD_LOGIC_VECTOR(7 downto 0);
@debreuil
debreuil / Mario's prime day
Created January 25, 2011 00:32
Seems like I have reached a prime age in a prime year. That's the 5th time in my life. I guess smart people could calculate my age now.
#define TEST
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class Program
#include <AFMotor.h>
#include <ServoTimer1.h>
//#define DEBUG 1
int analogPin = 0;
int sensorPin = 2;
int servo1Pin = 9;
AF_Stepper motorX(48, 2);
void loop()
{
if (Serial.available())
{
char ch = Serial.read();
switch(ch) {
case '0'...'9':
serialReadNum = serialReadNum * 10 + ch - '0';