Skip to content

Instantly share code, notes, and snippets.

View olizilla's full-sized avatar

Oli Evans olizilla

View GitHub Profile
@olizilla
olizilla / withCanvas.js
Created January 3, 2011 09:05
olizilla gets up close and functional with javascript. withCanvas provides a temporary canvas to another function, and always remembers to clean up after itself.
// Provide a function with a temporary canvas, encapsulating the creation and clean up code.
function withCanvas(/*canvas => Any*/ use) {
var b = document.body;
// create canvas
var canvas = document.createElement("canvas");
// canvas doesn't draw well unless it's added to the page
b.appendChild(canvas);
@olizilla
olizilla / pom.xml
Created June 14, 2012 09:48
Maven pom.xml - Minimal
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>minimal-pom</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<!-- Avoid using the platform default encoding... http://maven.apache.org/general.html#encoding-warning -->
@olizilla
olizilla / index.html
Created December 8, 2012 13:25
SVG sine wave
<html>
<head>
<meta charset="utf-8">
<style>
body{
margin:0;
background: #222;
}
</style>
</head>
@olizilla
olizilla / index.html
Created December 10, 2012 21:22
D3 Sine Worm
<html>
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v2.js"></script>
<style>
body{
margin:0;
background: #222;
}
.controls{
{
"points": {
"point": [
{
"latitude": "{{ latitude }}",
"longitude": "{{ longitude }}"
}
]
}
}
@olizilla
olizilla / index.html
Last active December 10, 2015 01:38
Unicode
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Unicode</title>
<style type="text/css">
#output {
font-family: monospace;
text-align: center;
margin-top: 0.4em;
@olizilla
olizilla / foo.ext3.js
Last active December 11, 2015 21:48
A proposal for an ExtJS 3 component initialisation pattern.
Ext.namespace('foo');
foo.UpdatePositionDialog = Ext.extend(Ext.Window, {
/**
* @param {Object} config Instance configuration options
*/
constructor:function (config) {
// Merge the incoming config with the defaults. Externally provided properties take precedence.
@olizilla
olizilla / README.md
Last active December 13, 2015 20:38
How to Node, NPM, Grunt, Git and Heroku

Problem: I'd prefer not to commit compiled resources to my repository, but I've still gotta deploy the thing.

Simple solution: Commit compiled resources...

Bonus credit solution: npm postinstall task runs grunt, grunt creates the compiled resources, heroku can then automagic on git push, rainbows and unicorns ensue.1,2

Your milage may vary, but on the happy path a git push heroku can deploy and run your node app.

Getting grunt to do your bidding is covered elsewhere. GRUNTEND is a fine bootstrap to getting your HTML5 Boilerplate app rolling on grunt: https://github.com/alanshaw/gruntend

@olizilla
olizilla / meteor-dump.sh
Last active May 29, 2016 02:18
Dump a mongo db from a live meteor app to a local dump dir.
#!/bin/bash
# __
# _____ ____ _/ |_ ____ ____ _______
# / \ _/ __ \ \ __\_/ __ \ / _ \ \_ __ \
# | Y Y \\ ___/ | | \ ___/ ( <_> ) | | \/
# |__|_| / \___ > |__| \___ > \____/ |__|
# \/ \/ \/
#
# .___
# __| _/ __ __ _____ ______
@olizilla
olizilla / how-to-eclipsify-a-bad-webapp.md
Last active December 15, 2015 12:49
From webapp sludge to a working Eclipse project deployed to local Tomcat

How to eclipsify a bad webapp

Assumptions

  • Tomcat 7 is available and imported into eclipse
  • Eclipse Juno, EE flavour.

Any mismatch between these assumptions and reality may result in failures and face-palm.

Steps