Skip to content

Instantly share code, notes, and snippets.

// <div>
// <svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" version="1.2">
// <circle cx="200" cy="200" r="100" fill="red" stroke="blue" stroke-width="10" />
// </svg>
// </div>
// svg {
// outline: 1px solid red;
// width: 400px;
@louisbros
louisbros / Wave.js
Last active August 29, 2015 14:23
Animated Sine Wave
/*
<style>
html, body {
margin:0;
padding:0;
}
#canvas-wrapper {
margin: 20px auto 10px auto;
@louisbros
louisbros / QuickSort.js
Last active August 29, 2015 14:21
JavaScript QuickSort Impl
function getRandomNumber(min, max) {
return Math.round(Math.random() * (max - min) + min);
}
function lessThan(a, b) {
return a < b;
}
function comparator(predicate) {
@louisbros
louisbros / QuickSort.java
Created January 22, 2014 07:56
Java Quicksort
package com.test;
import java.util.Collections;
import java.util.List;
public class QuickSort<T extends Comparable<T>> {
public void sort(List<T> values) {
quickSort(0, values.size() - 1, values);
@louisbros
louisbros / MergeSort.java
Last active October 16, 2019 03:16
Java Merge Sort
package com.test;
import java.util.ArrayList;
import java.util.List;
public class MergeSort<T extends Comparable<T>> {
public void sort(List<T> values){
mergeSort(0, values.size() - 1, values, new ArrayList<T>(values));
}
@louisbros
louisbros / Animator.js
Last active December 16, 2015 15:29
A simple JavaScript class for DOM object property animation without jQuery. - http://jsfiddle.net/louisbros/bkVQX/
function Animator() {
this._animated = [];
this.EASING = {
easeInOutCubic: function (e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return h / 2 * f * f * f + a;
}
return h / 2 * ((f -= 2) * f * f + 2) + a;
},
easeOutBounce: function (e, f, a, h, g) {