Skip to content

Instantly share code, notes, and snippets.

(function(){
/*
* Reflector JavaScript Library version 1.0
* http://lab.hisasann.com/reflector/
*
* Copyright (c) 2009 hisasann http://hisasann.com/
* Dual licensed under the MIT and GPL licenses.
*/
var Reflector = function(){}
function webGLStart() {
var pos, $id = function(d) { return document.getElementById(d); };
//Create moon
var moon = new PhiloGL.O3D.Sphere({
nlat: 30,
nlong: 30,
radius: 2,
textures: 'moon.gif'
});
@cagerton
cagerton / edge_detect.java
Created May 15, 2011 20:25
Edge detection in Processing
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
PImage input, output;
void setup() {
int width=400;
int height=300;
size(width,height);
output = createImage(width,height,RGB);
@erjjones
erjjones / JekyllListAllPosts.html
Created March 8, 2012 03:22
Jekyll List All Posts
{% for post in site.posts %}
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
<p><small><strong>{{ post.date | date: "%B %e, %Y" }}</strong> . {{ post.category }} . <a href="http://erjjones.github.com{{ post.url }}#disqus_thread"></a></small></p>
{% endfor %}
@traysr
traysr / l10n_IETF_Language_tags.md
Created March 8, 2012 14:58
Commonly used IETF language tags
@ken47
ken47 / gist:3870213
Created October 11, 2012 04:41
single-layer perceptron in Octave / Matlab
function perceptron0 = perceptron(numPoints, runs)
iters = 0;
for i = 1:runs
errors = 2;
points = genPoints(numPoints);
gWeights = [0 0 0];
[fWeights,a,b] = genTarget;
while errors > 0
errors = 0;
@mucar
mucar / random_color_array.js
Created October 16, 2012 11:47
Javascript Random Color Array
var colorArray = ['#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6',
'#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D',
'#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A',
'#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC',
'#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC',
'#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399',
'#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680',
'#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933',
'#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3',
'#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF'];
@tedmiston
tedmiston / webcam-cv2.py
Last active May 4, 2023 11:56
Display the webcam in Python using OpenCV (cv2)
"""
Simply display the contents of the webcam with optional mirroring using OpenCV
via the new Pythonic cv2 interface. Press <esc> to quit.
"""
import cv2
def show_webcam(mirror=False):
cam = cv2.VideoCapture(0)
@stephenscaff
stephenscaff / Random Images on Refresh
Last active October 21, 2023 07:29
Super simple way to randomly load new images on refresh via Jquery and DOM injection. Great for banners.
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;