Skip to content

Instantly share code, notes, and snippets.

@williammalo
williammalo / README.md
Last active October 2, 2015 16:47 — forked from 140bytes/LICENSE.txt
print time

Returns a string that formats time in a smart manner. If minutes is lower than 10, prepend a "0" to the minutes. If hours is in the afternoon, convert it to PM mode.

Thanks to xpansive for minification tips.

@williammalo
williammalo / README.md
Last active October 2, 2015 16:48 — forked from 140bytes/LICENSE.txt
paralaxr

Add parallax scrolling to a page's background.

@williammalo
williammalo / README.md
Last active October 2, 2015 22:47 — forked from 140bytes/LICENSE.txt
Draw mandelbrot fractal on canvas

Draws a mandelbrot fractal on a canvas.

usage:

mandelbrot(imageData,width)

Thanks to @atk for doing most of the minification work!

@williammalo
williammalo / README.md
Last active October 3, 2015 01:37 — forked from 140bytes/LICENSE.txt
number splitter

Splits numbers with commas to make them more readable. Thanks to @maettig for being awesome

@williammalo
williammalo / README.md
Last active March 9, 2020 15:58 — forked from 140bytes/LICENSE.txt
Make font size work with percentage
@williammalo
williammalo / README.md
Last active March 8, 2018 11:52 — forked from 140bytes/LICENSE.txt
get query variable

use like this:

getQueryVariable("foo")

To get variables in urls eg:

http://foo.com/index.html?foo=bar

If you want to support arrays, check the version by @atk below:

@williammalo
williammalo / README.md
Last active October 5, 2015 00:57 — forked from 140bytes/LICENSE.txt
parse indentation of string

This function returns an array of the indentation level of each line of a string.

I made this as part of a yaml parser I'm trying to do =D

you use it like this:

getIndent("\t\t\ttext\n\tmore text\nnot indented")

and it returns this:

@williammalo
williammalo / README.md
Last active March 28, 2018 16:18 — forked from 140bytes/LICENSE.txt
jquery animate clone

A clone of the jquery animate function for NEW BROWSERS ONLY!

For now, you need to add a vendor prefix for it to work, but it will work in future browsers just fine.

To use the function, add it as an element prototype and use it just like you would use the jquery animate function:

element.animate(properties,duration,callback)

Also, I am aware that my coding skills suck a bit =)

@williammalo
williammalo / README.md
Last active October 5, 2015 13:58 — forked from 140bytes/LICENSE.txt
nodelists to arrays

This code transparently makes nodelists act like arrays!

With it, you can do this:

document.getElementsByTagName('a').forEach(function(a){

a.style.color = '#F00'

})​

@williammalo
williammalo / README.md
Last active January 27, 2018 00:48 — forked from 140bytes/LICENSE.txt
Complete jquery css method clone

A perfect replica (hopefully) of the jQuery .css() method

testNode.css("color","blue")   //use it with two string arguments!

testNode.css({color:"red"})    //use it with an object!

testNode.css("color")          //make it return the value of a property

It's even chainable!