Skip to content

Instantly share code, notes, and snippets.

@webdesserts
webdesserts / testing_element_existence.js
Last active December 31, 2015 04:29
Testing for the presence of an item in an array with `.indexOf()` and the `~` bitwise operator
var desserts = ['gelato', 'tiramisu', 'double chocolate volcano cake']
// indexOf() is a nifty little Array method that returns the index of the element passed
desserts.indexOf('gelato') //=> 0
// One oditty of it is that it returns -1 if there is no match.
desserts.indexOf('meatloaf') //=> -1
// So the question arrises, "why -1"?
@webdesserts
webdesserts / javachip.md
Last active August 29, 2015 13:57
Conceptual exploration of what JavaScript could be

JavaChip

JavaChip my attempt to make JavaScript simpler, more predictable, and provide control-flow tools to make development in an asyncronous environment more comfortable.

Conventions

[] – a collection of data (arrays, lists, dicts, hashes)

@webdesserts
webdesserts / AlchemistAPI.js
Last active August 29, 2015 14:08
Alchemist API
/**========================================*
* Alchemist.js - Exploring a possible API *
*=========================================*/
/**=============*
* Conversions *
*=============**/
@webdesserts
webdesserts / prototype.js
Last active August 29, 2015 14:10
Prototype .create() pattern
// create a "Class-like" object
var Point = {}
// create an object like this one, but with a clean state
Point.create = function create () {
var new_shape = Object.create(this)
new_shape.init.apply(new_shape, arguments)
return new_shape
}
@webdesserts
webdesserts / languages.md
Last active August 29, 2015 14:15
Programming languages that should exist
{
"name": "web-app",
"scripts": {
"build": "gulp build",
"start": "gulp serve",
"test": "gulp test"
},
"devDependencies": {
"gulp": "~3"
}
@webdesserts
webdesserts / file1.css
Last active April 12, 2016 20:55
nesting classes from external css-modules
.code-block {
/* My special code block. Covers 90% of all use cases. */
}

Keybase proof

I hereby claim:

  • I am webdesserts on github.
  • I am webdesserts (https://keybase.io/webdesserts) on keybase.
  • I have a public key whose fingerprint is EFEF AB55 BA03 4063 BB37 6F25 BD9D 259B A9DF DEE0

To claim this, I am signing this object: