Skip to content

Instantly share code, notes, and snippets.

View lonelydatum's full-sized avatar
💭
working on prequilt

Gar lonelydatum

💭
working on prequilt
View GitHub Profile
// Bind context
_.bindAll( this, "animate", "render", "update" );
// Initialize camera
this.camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, -2000, 10000 );
this.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -2000, 10000 );
this.camera.position.y = 70.711;
this.camera.position.x = 100;
this.camera.position.z = 100;
@lonelydatum
lonelydatum / gist:4772777
Last active December 12, 2015 12:29
HTML: with jquery
<html>
<head>
<title>jquery</title>
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="scripts/vendor/jquery.min.js"><\/script>')</script>
</body>
@lonelydatum
lonelydatum / gist:4772852
Created February 12, 2013 19:55
JavaScript: pubsub
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
@lonelydatum
lonelydatum / gist:4772871
Created February 12, 2013 19:57
CSS: image replacement
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@lonelydatum
lonelydatum / gist:4772888
Created February 12, 2013 20:00
JQuery: pubsub
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@lonelydatum
lonelydatum / gist:4772929
Last active December 12, 2015 12:38 — forked from padolsey/gist:527683
JavaScript: detect ie version
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@lonelydatum
lonelydatum / gist:4954527
Created February 14, 2013 17:37
Bootstrap: template
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<h1>Hello, world!</h1>
@lonelydatum
lonelydatum / Gruntfile.js
Last active August 29, 2015 14:15
grunt file
//gar liu liu
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
@lonelydatum
lonelydatum / package.json
Last active August 29, 2015 14:15
package.json
{
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-text-replace": "~0.4.0",
"grunt-open": "~0.2.3"
}
@lonelydatum
lonelydatum / package.json
Last active August 29, 2015 14:15
package
{
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-text-replace": "~0.4.0",
"grunt-open": "~0.2.3",
"connect-livereload": "~0.5.2",