Skip to content

Instantly share code, notes, and snippets.

@getflourish
getflourish / CubeMap.pde
Created July 12, 2011 09:05
How to generate a cube map from 6 textures for use with a shader. Uses GLGraphics and OpenGL
import codeanticode.glgraphics.*;
import processing.opengl.*;
import javax.media.opengl.*;
import java.nio.IntBuffer;
GL gl;
GLSLShader shader;
PGraphicsOpenGL pgl;
int[] envMapTextureID = {0};
GLTexture[] textures;
GLModel getGLModelForOBJModel (OBJModel model) {
GLModel model = model;
model.enableDebug();
glmodel = new GLModel(this, model.getFaceCount() * 3, TRIANGLES, GLModel.DYNAMIC);
// copy vertices from OBJModel to GLModel
glmodel.beginUpdateVertices();
int index = 0;
float maxX = 0;
@getflourish
getflourish / gist:1235939
Created September 22, 2011 20:28
grid.css
#grid {
width: 740px;
margin: 108px auto 0px auto;
padding-left: 200px;
}
.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12, .grid_13, .grid_14, .grid_15, .grid_16, .suffix_4 {margin: 20px 10px; display: inline-block; vertical-align: top;}
.grid_1{width:40px}
.grid_2{width:100px}
.grid_3{width:160px}
@getflourish
getflourish / functions.php
Created September 23, 2011 09:08
Override Wordpress Default Medium Image Size
<?php
add_filter( 'pre_option_medium_size_w', 'my_override_medium_size_w' );
function my_override_medium_size_w($size) {
return 123;
}
?>
<script type="text/javascript">
$(document).ready(function() {
$('#start-end').waypoint(function(event, direction) {
if (direction == "down") {
$('nav').css('position', 'fixed');
} else {
$('nav').css('position', 'relative');
}
}, {
offset: 0
@getflourish
getflourish / scrollPage.js
Created October 12, 2011 12:20
Scroll to an anchor with transition
<script type="text/javascript">
$(document).ready(function() {
$('.scrollPage').click(function() {
var elementClicked = $(this).attr("href");
var destination = $(elementClicked).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination+1}, 500, function() { window.location.href = elementClicked;} );
return false;
});
});
</script>
<div id="download-popup" class="reveal-modal">
<h1>Cloud-Free Data Download</h1>
<section>
<h5>Download Summary</h5>
<h3>Kyrgyzstan<br>November 21, 2010 – December 29, 2010</h3>
</section>
<section>
<h5>Data Format</h5>
<p>Please choose the data format that you want to download.</p>
</section>
@getflourish
getflourish / STTExternalMic.pde
Last active December 17, 2015 19:39
Use STT with an External Microphone
/*
// Using External Microphones with STT
// www.getflourish.com/sst/
//
// Florian Schulz 2013
*/
import com.getflourish.stt.*;
import ddf.minim.*;
import javax.sound.sampled.*;
@getflourish
getflourish / gist:8319361
Created January 8, 2014 16:14
Firebase sync
$scope.setupFirebase = function () {
ref = new Firebase("https://*.firebaseio.com/foo");
$scope.items = $firebase(ref);
}
$scope.addItem = function() {
$scope.items.images.push(Math.random(999));
$scope.items.$save();
}
$scope.generateData = function(n) {
var fakeData = {"keys":[], "values":[]};
var months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",