Skip to content

Instantly share code, notes, and snippets.

@baniol
baniol / canvas_animation.html
Created March 29, 2014 09:54
basic canvas animation, javascript, requestAnimationFrame, solar system
<html>
<head>
<style type="text/css">
/*canvas{ width: 300px; height: 300px;}*/
</style>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
@baniol
baniol / avoiding.html
Created March 30, 2014 19:27
avoiding collision, canvas, animation, ai
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Bouncing 1</title>
<link rel="stylesheet" href="./include/style.css">
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
@baniol
baniol / module_pattern.js
Created March 31, 2014 07:01
javascript, design patterns, module pattern
// A Module Pattern
PACKAGE_NAME.M = (function () {
var privatePropertyOrMethod1 = …;
// …
var M = {};
M.publicProperty1 = …;
M.publicMethod1 = function (…) {…};
@baniol
baniol / type_pattern.js
Created March 31, 2014 07:42
javascript, design patterns, type pattern
// Type Pattern
<package>.T = (function () {
var T = {};
// Shared properties and methods go here
T.create = function (…) {
vart = Object.create(this);
// Assign the own properties here
@baniol
baniol / jquery.getUrlVars.js
Created April 4, 2014 13:51
jquery, querystring, plugin, url
// from: http://stackoverflow.com/a/7731878
$.extend({
getUrlVars: function() {
var vars = [],
hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
@baniol
baniol / MyChat.js
Last active August 29, 2015 13:58
nodejs, express, socket.io, ejs, basic server
window.onload = function () {
var messages = [],
socket = io.connect(window.location.origin),
display = document.getElementsByTagName('output')[0],
button = document.getElementsByTagName('button')[0],
content = document.getElementById('msg');
socket.on('message', function (data) {
if (data.message) {
messages.push(data.message);
@baniol
baniol / html_slider.html
Created April 5, 2014 20:07
html5 slider range css
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
body {
padding-top: 200px;
}
input::after {
content: attr(data-value) '/' attr(max);
@baniol
baniol / spreadsheet_api.html
Created April 6, 2014 00:09
google drive api, spreadsheet
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<script>
// https://coderwall.com/p/duapqq
@baniol
baniol / jshint_hook.py
Created April 11, 2014 09:01 — forked from matthewlein/.jshintrc
jshint, git hook, python script
{
"devel": false,
"undef": true
}
@baniol
baniol / .vimrc_change
Created April 15, 2014 06:32
change .vimrc default location
set runtimepath^=~/Dropbox/vim/.vim
source ~/Dropbox/vim/.vimrc