Skip to content

Instantly share code, notes, and snippets.

View krilo's full-sized avatar

Kristofer Forsell krilo

  • DEPT Dogstudio
  • Amsterdam
View GitHub Profile
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.OTransition !== undefined || thisStyle.transition !== undefined;
return support;
})();
Math.min(Math.max(min, value), max);
@krilo
krilo / gist:891986
Created March 29, 2011 08:19
Make FontFace work
/*Add this to the appropriate tag*/
-webkit-font-smoothing: antialiased;
@font-face {
font-family: 'MyFontFamily';
src: url('myfont-webfont.eot?') format('eot'),
url('myfont-webfont.woff') format('woff'),
url('myfont-webfont.ttf') format('truetype'),
url('myfont-webfont.svg#svgFontName') format('svg');
}
@krilo
krilo / OpenCV Header Search Paths
Created October 12, 2011 07:48
OpenCV Header Search Paths
$(OF_PATH)/addons/ofxOpenCv/src
$(OF_PATH)/addons/ofxOpenCv/libs/opencv/include
$(OF_PATH)/addons/ofxOpenCv/libs/opencv/include/opencv
@krilo
krilo / gist:1363775
Created November 14, 2011 11:38
Generate an array of rows from a string. Eg. find where to put rowbreaks
function stringToMultiline (string, charLimit) {
var words = string.split(" ");
var currentLineLength = 0;
var currentRow = "";
var rows = new Array();
for (var i = 0; i < words.length; i++) {
if (currentLineLength + words[i].length <= charLimit){
@krilo
krilo / PaperCircle
Created March 1, 2012 20:08
Paperscript circle diagram base
/ Variables
var centerPoint = new Point(view.viewSize.width/2, view.viewSize.height/2);
var outerDiameter = 30;
var outerRadius = outerDiameter/2;
var innerDiameter = 15;
var innerRadius = innerDiameter/2;
// Outer Guide Circle
outerGuideCircle = new Path.Circle(centerPoint , outerRadius);
outerGuideCircle.rotate(90, centerPoint);
@krilo
krilo / index.html
Created March 8, 2012 09:36
Circular Preloader
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Circular Progressbar</title>
<script type="text/javascript" src="http://paperjs.org/static/js/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
// Variables
var centerPoint = new Point(view.viewSize.width/2, view.viewSize.height/2);
@krilo
krilo / gist:3666042
Created September 7, 2012 12:55
Compile coffeescript with Snockets in Node.js
// Compile Coffescript
function compileCoffee() {
snockets.getConcatenation('public/javascripts/app.coffee', {
minify: false,
async: false
}, function(err, js) {
fs.writeFile("public/javascripts/app.js", js, function(err) {
if(err) {
console.log(err);
}
class binory.Controller
# Subscriber
_(Controller.prototype).defaults binory.Subscriber
model: null
collection: null
view: null
currentId: null
@krilo
krilo / Legal Drinking Ages
Last active December 16, 2015 05:59
Legal Drinking Ages in a dropdown