Skip to content

Instantly share code, notes, and snippets.

View oliviercardoen's full-sized avatar

Olivier Cardoen oliviercardoen

  • Octopix
  • Belgique
View GitHub Profile
.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js
@akre54
akre54 / backbone.fetch.js
Last active November 22, 2023 19:10
Backbone.ajax with window.fetch
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
return obj;
}
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {
@rileypaulsen
rileypaulsen / JSON REST API Tax Query
Created August 23, 2014 23:03
Use a tax_query in a JSON REST API request
//requires authentication
add_filter('json_query_vars','accept_new_queries');
add_filter('json_query_var-tax_query', 'filter_by_taxonomy');
function accept_new_queries($filters){
return array_merge($filters,array('tax_query'));
}
function filter_by_taxonomy($val){
@funkjedi
funkjedi / marionette.handlebars.js
Last active April 5, 2024 14:29
Integrates Handlebars with Marionette. First attempts to load pre-compiled templates, then by selector, and finally via XHR.
/**
Usage: Just include this script after Marionette and Handlebars loading
IF you use require.js add script to shim and describe it in the requirements
*/
(function(Handlebars, Marionette) {
Marionette.Handlebars = {
path: 'templates/',
extension: '.handlebars'
};
@Rarst
Rarst / class-autoload-wp.php
Created February 27, 2013 17:47
Generic autoloader for classes named in WordPress coding style.
<?php
if ( ! class_exists( 'Autoload_WP' ) ) {
/**
* Generic autoloader for classes named in WordPress coding style.
*/
class Autoload_WP {
public $dir = __DIR__;
@ocean90
ocean90 / box-shadow.html
Last active April 11, 2024 13:54
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;