Skip to content

Instantly share code, notes, and snippets.

Oli Evans olizilla

View GitHub Profile
@olizilla
olizilla / withCanvas.js
Created Jan 3, 2011
olizilla gets up close and functional with javascript. withCanvas provides a temporary canvas to another function, and always remembers to clean up after itself.
View withCanvas.js
// 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 Jun 14, 2012
Maven pom.xml - Minimal
View pom.xml
<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 -->
View index.html
<html>
<head>
<meta charset="utf-8">
<style>
body{
margin:0;
background: #222;
}
</style>
</head>
View index.html
<html>
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v2.js"></script>
<style>
body{
margin:0;
background: #222;
}
.controls{
View geckoboard.map.json
{
"points": {
"point": [
{
"latitude": "{{ latitude }}",
"longitude": "{{ longitude }}"
}
]
}
}
View index.html
<!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 Dec 11, 2015
A proposal for an ExtJS 3 component initialisation pattern.
View foo.ext3.js
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 Dec 13, 2015
How to Node, NPM, Grunt, Git and Heroku
View README.md

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
Dump a mongo db from a live meteor app to a local dump dir.
View meteor-dump.sh
#!/bin/bash
# __
# _____ ____ _/ |_ ____ ____ _______
# / \ _/ __ \ \ __\_/ __ \ / _ \ \_ __ \
# | Y Y \\ ___/ | | \ ___/ ( <_> ) | | \/
# |__|_| / \___ > |__| \___ > \____/ |__|
# \/ \/ \/
#
# .___
# __| _/ __ __ _____ ______
@olizilla
olizilla / how-to-eclipsify-a-bad-webapp.md
Last active Dec 15, 2015
From webapp sludge to a working Eclipse project deployed to local Tomcat
View how-to-eclipsify-a-bad-webapp.md

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

You can’t perform that action at this time.