Skip to content

Instantly share code, notes, and snippets.

@SimeonC
SimeonC / ReduxRouterConnect.jsx
Created November 1, 2016 22:55
react-router v4 Simple Redux Connect setup.
import React, {Component} from 'react';
import {connect} from 'react-redux';
class ReduxRouterConnect extends Component {
static contextTypes = {
router: React.PropTypes.object
};
componentWillReceiveProps(nextProps) {
if (nextProps.to !== this.props.to) {
@SimeonC
SimeonC / lrInfiniteScroll_shim.js
Last active May 25, 2016 18:58
A shim for lrInfiniteScroll to support targets. See https://github.com/lorenzofox3/lrInfiniteScroll/issues/11
appModule.directive(
'lrInfiniteScroll', [
'$timeout', function (timeout) {
return {
link: function (scope, element, attr) {
var
lengthThreshold = attr.scrollThreshold || 50,
timeThreshold = attr.timeThreshold || 400,
handler = scope.$eval(attr.lrInfiniteScroll),
promise = null,
@SimeonC
SimeonC / dateTimeDialog.jade
Created September 20, 2015 21:01
A demo for input trigger for sc-date-time-picker. Uses Angular-Strap for it's $modal service.
.modal(tabindex="-1" role="dialog" aria-hidden="true")
.modal-dialog.time-date
.modal-content
time-date-picker(
display-mode="{{displayMode}}"
default-mode="{{defaultMode}}"
default-date="{{defaultDate}}"
mindate="{{mindate}}"
maxdate="{{maxdate}}"
ng-model="model"
@SimeonC
SimeonC / angular-toastr.d.ts
Created September 2, 2015 02:50
Angular-Toastr Typescript Definition file
// Type definitions for Toastr 1.5.0
// Project: https://github.com/Foxandxss/angular-toastr
/// <reference path="./angular.d.ts" />
declare module toastr {
/**
* The settings that define the look and feel of the toasts
*/
export interface IBaseOptions {
@SimeonC
SimeonC / md-colors-shim.js
Created June 3, 2015 01:46
Adding .md-fg and .md-bg to the dynamic css for material design
/* Inspired from https://github.com/angular/material/pull/1599 */
(function () {
"use strict";
/**
* @ngdoc run
* @module material.core.color
*
* @description
* This builds in the css styles to allow use of .md-accent.md-fg to apply the accent class to the foreground (css color attribute).
*
@SimeonC
SimeonC / squel.coffee
Last active August 29, 2015 14:06
Custom wrapper for squel, I require this file instead of requiring squel itself. This specifically targets using squel and tedious.
squel = require 'squel'
squel.useFlavour 'mssql'
squel.cls.DefaultQueryBuilderOptions.autoQuoteAliasNames = true
squel.cls.DefaultQueryBuilderOptions.tableAliasQuoteCharacter = '"'
_parsers = [
# if a field ends with (Date) then parse the value as a date
regex: /\(Date\)$/
parse: (value) -> new Date value