Skip to content

Instantly share code, notes, and snippets.

View bmoren's full-sized avatar

Ben Moren bmoren

View GitHub Profile
@bmoren
bmoren / basic_response.php
Last active August 29, 2015 14:06
Twilio Rest SMS reply
<?php>
//~~~~~~~~~~~~~~~BASIC RESPONSE EXAMPLE ~~~~~~~~~~~~~//
$client = new Services_Twilio($AccountSid, $AuthToken);
$body = $inbody . "" . ":and the PHP added ME!" ;
$message = $client->account->sms_messages->create($from, $to, $body);
<?>
@bmoren
bmoren / for_loop.js
Last active August 29, 2015 14:06
Generative JS Snippets
//set an an amount to loop through (this is often an array called with array.length)
// the for loop, set a varioable called 'i' to 0, as long as 'i' is less than the variable amount, then increase 'i' by after it executes the code in the curly braces each time
for (var i=0; i<amount; i++){
//do stuff here
//do something each time!
console.log("this is iteration #" + i + " through the for loop");
// example to append a thing 10 times
$('.theCount').append("<p class='underline'>iteration #" + i + "</p>");
void setup() {
size(320,320);
frameRate(30);
}
void draw() {
// set background to black
background(0);
// get my current time values
@bmoren
bmoren / app.js
Last active August 29, 2015 14:07
jQuery Getting Started
/*
We are going to look at a number of different jQuery methods and a small amount of basic javascript so hold on to your horses!
please search for these methods in the jQuery API: http://api.jquery.com/
.addClass()
.removeClass()
.html()
.css()
.fadeIn() / .fadeOut()
@bmoren
bmoren / grid.html
Created October 20, 2014 23:20
CSS/ HTML Grid of 9 points
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style type="text/css" media="screen">
html{height:100%;}
body{height:100%;}
@bmoren
bmoren / webcam.html
Created October 21, 2014 15:23
HTML5 Webcam
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="stuff, to, help, search, engines, not" name="keywords">
<meta content="What this page is about." name="description">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<style>
@bmoren
bmoren / lightbikegame.pde
Last active August 29, 2015 14:10
a simple 2 player lightbike game in processing using WASD and ARROW Keys
///a simple 2 player lightbike game in processing using WASD and Arrow Keys.
//game params
int speed = 4;
int playerSize = speed + 1 ;
color p1color = color(255, 255, 0); //must have green for detection
color p2color = color(0, 255, 255); //must have green for detection
//player alive?
int player1status = 1;
@bmoren
bmoren / image_layer_1.pde
Created January 5, 2015 16:11
Image Layer #1
//path to image files (list) filenames as the following: 0001.jpg, 0002.jpg, 0003.jpg etc.
String PATH = "/Users/bmoren/Desktop/Aspens_test/JPG/";
int IMAGE_NB = 0001; // first in sequence
void setup()
{
//change to what you want your output to be
size(5184,3456);
background(255);
tint(255,10); // this setting will stick
}
@bmoren
bmoren / image_layer_2.pde
Created January 5, 2015 16:12
Image Layer #2
String PATH = "/Users/bmoren/Desktop/Aspens_test/JPG/";
int IMAGE_NB = 0001; // first in sequence
int imageAlpha = 100;
PImage composition;
PImage workingImage;
boolean firstImage = true;
void setup()
@bmoren
bmoren / keypress.js
Created March 2, 2015 23:56
Jquery Keypress Event
$(function(){ //jq do some work! - when ever the DOM is ready, do the stuff in here!
$(document).keypress(function(e) { // look at the keypressed
if(e.which == 97) { // use some logic to see what key was pressed
alert('You pressed "A"!'); //do something when that key was pressed
}
});
///////USE BELOW TO FIGURE OUT KEY NUMBERS!
$(document).keypress(function(e) {