Skip to content

Instantly share code, notes, and snippets.

@krambertech
krambertech / Component.jsx
Created July 2, 2016 10:44
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();
@ssajous
ssajous / bootstrapShowModal.js
Last active April 12, 2018 13:39
Knockout.js binding handle to hide and show bootstrap modal dialog. jsFiddle example http://jsfiddle.net/shub2079/TAtvU/
// Custom binding for modal dialog
// Bind a Bootstrap modal div to an observable
// boolean. When the observable changes, the
// modal window's visibility will also change.
//
// The binding is two-way, so changes to the
// modal window's visibility will also change
// the bound observable's value
ko.bindingHandlers.bootstrapShowModal = {
init: function (element, valueAccessor) {
@thomseddon
thomseddon / gist:5511325
Last active December 16, 2015 22:59
Connect sessions only on certain routes
var session = express.session();
// Slightly Invasive
app.get('/home', session, routes.home);
app.get('/about', routes.about);
app.get('/faq', routes.faq);
// or
// Crude
@michaelcox
michaelcox / SpecRunner.js
Last active January 11, 2024 06:05
Browser Unit Testing with Backbone Mocha Chai and RequireJS
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@mcollina
mcollina / back.js
Created May 17, 2011 15:24
Sencha Touch Back Button Plugin
BackButton = Ext.extend(Ext.Button, {
ui: 'back',
text: 'Back',
hidden: true,
id: 'back',
handler: function() {
var dispatchOptions = this.backStack.pop();
Ext.dispatch(dispatchOptions);
if(this.backStack.length == 0) {
@bzerangue
bzerangue / master.xsl
Created November 15, 2010 21:36
HTML5 Boilerplate XSLT Master Stylesheet, see html5boilerplate.com
<?xml version="1.0" encoding="UTF-8" ?>
<!--
HTML5 Boilerplate XSLT Master Stylesheet (based on Paul Irish's HTML5 Boilerplate index.html file)
Created by Brian Zerangue on 2010-11-15.
Copyright (c) 2010 Paul Irish (Everything but the XSLT), Brian Zerangue (XSLT).
HTML5 Boilerplate, http://html5boilerplate.com
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">