Skip to content

Instantly share code, notes, and snippets.

View caracal7's full-sized avatar

Dmitrii Vasilev caracal7

  • This planet
View GitHub Profile
@cowboy
cowboy / stringify.js
Created September 19, 2012 13:45
JavaScript: like JSON.stringify but handles functions, good for creating arbitrary .js objects?
var stringify = function(obj, prop) {
var placeholder = '____PLACEHOLDER____';
var fns = [];
var json = JSON.stringify(obj, function(key, value) {
if (typeof value === 'function') {
fns.push(value);
return placeholder;
}
return value;
}, 2);
@ElliotChong
ElliotChong / proxy.js
Created September 4, 2012 17:57
JavaScript implementation of a Proxy class.
/**
* JavaScript implementation of a Proxy class.
**/
​function Proxy(p_target)
{
var self = this;
self.target = p_target;
// Access target's properties
self.get = function (p_property)
@brycec
brycec / LICENSE.txt
Created August 21, 2012 00:11 — forked from 140bytes/LICENSE.txt
dom builder
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sdepold
sdepold / LICENSE.txt
Created August 15, 2012 05:50 — forked from 140bytes/LICENSE.txt
140byt.es -- addObserverMethods
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Sascha Depold http://depold.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tuzz
tuzz / github.css
Last active April 19, 2025 21:11
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Armen138
Armen138 / astar.js
Created August 6, 2012 18:21
Pathfinding Web Worker
function Vector(x, y) {
var v = {
X: x,
Y: y,
is: function(o) { return v.X === o.X && v.Y === o.Y },
distanceTo: function(o) { return Math.sqrt(Math.pow(Math.abs(v.X - o.X), 2) + Math.pow(Math.abs(v.Y - o.Y), 2)); }
}
return v;
}
function isInList(item, list){
@Olical
Olical / LICENSE.txt
Created June 28, 2012 09:33 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@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!

@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 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: