Skip to content

Instantly share code, notes, and snippets.

@Boorj
Boorj / 0_reuse_code.js
Created January 10, 2014 16:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Boorj
Boorj / javascript_resources.md
Created January 10, 2014 16:46 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
<?php
/**
* Bolt config v0.1 (16.05.2015)
*/
// My server (apache on localhost and nginx on remote) takes /web dir as web_dir
// 1.
// Remote server index file is app.php

from carlo.zottmann.org

Did you know Google runs a free and open image resizing service? I certainly didn't.

While lazily poking around the Google+ HTML I found an interesting thing: for resizing post images on the fly, G+ uses an open API endpoint. That might come in handy at some point in the future when prototyping this or that, so jotting down some notes felt like a good idea.

If you know more about this API, let me know, please! (See the sidebar for options.)

A word of warning before I progress: I've spent ~45 minutes on both my experimentation and this here write-up, maybe an hour. You've been warned.

@Boorj
Boorj / backbone_description.md
Created July 12, 2015 09:13
Backbone documentation in markdown format

Source

Backbone.js

![Backbone.js][1]

Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.

The project is [hosted on GitHub][2], and the [annotated source code][3] is available, as well as an online [test suite][4], an [example application][5], a [list of tutorials][6] and a long list of real-world projects that use Backbone. Backbone is available for use under the [MIT software license][7].

@Boorj
Boorj / underscore_documentation.md
Created July 12, 2015 09:14
Underscore v1.8.3 documentation in markdown format

Collection Functions (Arrays or Objects)

each

_.each(list, iteratee, [context]) Alias: forEach
Iterates over a list of elements, yielding each in turn to an iteratee function. The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments: (element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list). Returns the list for chaining.

_.each([1, 2, 3], alert);
=> alerts each number in turn...
_.each({one: 1, two: 2, three: 3}, alert);

=> alerts each number value in turn...

source

The problem is not the transform. If you try logging the scrollTop value you'll see that firefox always returns 0, that's because ff has the scroll attached to the html, not the body. Here's a cross browser solution:

http://jsfiddle.net/jonigiuro/kDSqB/9/

var $cog = $('#cog'),
    $body = $('body'),
    bodyHeight = $body.height();
@Boorj
Boorj / AppInit.php
Created July 16, 2015 06:19
Custom init for bolt
<?php
namespace Mapple\Bolt;
use Bolt;
use Mapple\Bolt\CustomTranslationsProvider;
use SilexMtHaml\MtHamlServiceProvider;
Class AppInit {
public function __construct ($path) {
@Boorj
Boorj / General.php
Created July 25, 2015 17:28
Bolt's Mass Edit
// class General extends AsyncBase
protected function addRoutes(ControllerCollection $c)
{
//...
$c->get('/massedit/read/{contenttypeslug}', 'readMassEdit')
->value('data_type', 'values')
->bind('readmassedit');
//...
}
@Boorj
Boorj / Content.php
Last active August 29, 2015 14:26
Content.php update
<?php
namespace Bolt;
use Bolt\Helpers\Html;
use Bolt\Helpers\Input;
use Bolt\Helpers\Str;
use Bolt\Library as Lib;
use Maid\Maid;
use Silex;