Skip to content

Instantly share code, notes, and snippets.

@chrisirhc
chrisirhc / timeseries.html
Last active August 29, 2015 13:56
How to do multiple transclusions right
<te-widget>
<te-widget-config>
<div class="te-dash-config-search ui-form">
<input class="te-dash-config-search-field"
type="text" ng-model="tempCfg.search" ng-change="testLimit = 10" />
</div>
</te-widget-config>
<te-widget-body>
<te-timeseries timeseries-config="widget.config" />
@chrisirhc
chrisirhc / MongoId.java
Last active August 29, 2015 13:57
MongoIdModule
package com.example.db.mongo;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
// Override the serializer for ObjectId annotation
public @interface MongoId {
@chrisirhc
chrisirhc / daterange-picker.html
Last active August 29, 2015 14:00
Nested directives
<p class="input-group">
<input type="text" class="form-control"
ng-model="daterange[0]"
max-date="daterange[1]"
datepicker-popup is-open="isStartOpen"
/>
<span class="input-group-btn"><button type="button" class="btn btn-default" ng-click="startOpen($event)"><i class="glyphicon glyphicon-calendar"></i></button></span>
</p> -
<p class="input-group">
<input type="text" class="form-control"
@chrisirhc
chrisirhc / phantom-script.js
Last active August 29, 2015 14:03
A Pen by Chris Chua.
var page = require('webpage').create();
page.open('http://codepen.io/chrisirhc/full/xfhbo', function() {
console.log('Script never gets here on PhantomJS 1.9.7');
phantom.exit();
});
@chrisirhc
chrisirhc / .travis.yml
Last active August 29, 2015 14:05
Release repo
script:
- cp -a src build
- ls -la build
after_success: .travis/make-release.sh
@chrisirhc
chrisirhc / README.md
Last active August 29, 2015 14:11
Directive to add space after an ngRepeat element

Directive to add space after an ngRepeat element

To use:

<li ng-repeat="item in items" add-space-after>
</li>
@chrisirhc
chrisirhc / pre-push-check-master
Last active August 29, 2015 14:13
pre-push git hook to confirm when pushing to master
#!/bin/bash
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
if [ "$remote_ref" = "refs/heads/master" ]
then
echo "Pushing to master"
read -p "You're about to push $local_ref to master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
@chrisirhc
chrisirhc / d3.min.js
Created February 1, 2015 03:32
Timeseries Similarity
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object
@chrisirhc
chrisirhc / README.md
Last active August 29, 2015 14:20
How to convert to AngularJS' jqLite?

Seed for a blog article to convert from jQuery to jqLite. Finding all the bad usages of selectors in find and bad css calls.

@chrisirhc
chrisirhc / script.js
Created September 21, 2015 06:12
xwOgJX
var Container = React.createClass({
getInitialState: function () {
return {
contentComponent: ContentA,
headerProps: null
};
},
_toggleContent: function () {