Skip to content

Instantly share code, notes, and snippets.

View matthewstokeley's full-sized avatar
🎯
Focusing

Matthew Stokeley matthewstokeley

🎯
Focusing
View GitHub Profile
@rememberlenny
rememberlenny / gist:5164200
Last active December 14, 2015 23:18
Main.js file from Require.js on Foundation 4 through Yeoman.
require.config({
paths: {
jquery: '../components/jquery/jquery'
},
shim: {
"foundation/foundation" : { deps: ["jquery"] },
"foundation/foundation.alerts": { deps: ["jquery"] },
"foundation/foundation.clearing": { deps: ["jquery"] },
"foundation/foundation.cookie": { deps: ["jquery"] },
"foundation/foundation.dropdown": { deps: ["jquery"] },
@jubianchi
jubianchi / sf2_standalone_form.php
Created August 25, 2011 07:31
How to use Symfony2 Form Component Standalone
<?php
namespace Standalone\Form;
use \Symfony\Component\HttpFoundation as SHttp;
use \Symfony\Component\Form as SForm;
use \Symfony\Component\DependencyInjection as SDI;
use \Symfony\Bridge as SBridge;
//Register all your autoload function here
//...
@radiosilence
radiosilence / gist:4040553
Created November 8, 2012 18:19
RequireJS with Zurb Foundation
requirejs.config({
shim: {
'foundation/jquery.foundation.topbar': {
deps: ['jquery'],
},
'foundation/jquery.cookie': {
deps: ['jquery']
},
'foundation/jquery.event.move': {
deps: ['jquery']
@rstacruz
rstacruz / model_caching.coffee
Created September 11, 2011 14:54
Backbone.js model caching
# ## Backbone model caching
# This is a simple solution to the problem "how do I make less requests to
# my server?".
#
# Whenever you need a model instance, this will check first if the same thing
# has been fetched before, and gives you the same instance instead of fetching
# the same data from the server again.
#
# Reusing the same instance also has the great side-effect of making your
# model changeable from one part of your code, with your changes being available
@sheac
sheac / a-b-c-f.png
Last active May 22, 2019 17:45
Dependency Resolver
a-b-c-f.png
@albarin
albarin / filter.js
Created April 1, 2019 13:35
Script to filter OpenAPI spec
const pickBy = require('lodash.pickby')
const validate = require('./schema-validator.js')
const DEFAULT_FILTERS = [
{
key: 'x-visibility',
value: 'EXTERNAL'
},
{
key: 'x-status',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennadel
bennadel / lazy-loading-images.htm
Created July 23, 2013 13:04
Lazy Loading Image With AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">
@Thinkscape
Thinkscape / PSR-0-final-proposal.md
Created September 22, 2011 10:30
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
import {Object, Tuple, Number} from 'ts-toolbelt'
// Merge two types together
type merge = Object.MergeUp<{name: string}, {age?: number}>
// Update the type of a field
type update = Object.Update<{age: string}, 'age', number>
// Make some fields optional
type optional = Object.Optional<{name: string, age: number}, 'age'>