Skip to content

Instantly share code, notes, and snippets.

View patrickml's full-sized avatar

Patrick Lewis patrickml

View GitHub Profile
@patrickml
patrickml / Template
Created March 3, 2015 00:42
Meteor Joins
<template name="journal">
<div class="nav-block"></div>
<nav class="journal-nav">
<ul>
<li>
<a href="#" data-type="Design">Design</a>
</li>
<li>
<a href="#" data-type="Development">Development</a>
</li>
### Keybase proof
I hereby claim:
* I am patrickml on github.
* I am patrickml (https://keybase.io/patrickml) on keybase.
* I have a public key whose fingerprint is 76F4 B94C FBBF 465B 33C7 8319 A379 712C BFB3 E7D1
To claim this, I am signing this object:
@patrickml
patrickml / activity.collection.js
Last active August 29, 2015 14:22
Simple Activity Log by Collection for MeteorJS
/**
* Example Document
{
_id : 'xDvcFlsQws',
activity : 'Project Created',
createdAt : '1231213412312'
collection : 'projects',
documentId : 'xJ4iTyxDw2',
userId : 'pQ4iTyxDw7'
}
@patrickml
patrickml / Pretty URL
Last active October 1, 2015 23:02 — forked from anonymous/Pretty URL
$('#quoteForm').click(function(){
// Variables with data
var inputs = $('.modal-body').find('.form-group').children().not('label');
// Open variables
var data = {};
var rules = {};
var trueAll = [];
// Functions with in scope
Modal = React.createClass({
render () {
return (
<div className="md-modal md-effect-1" id="modal-1">
<div className="md-content">
<h3>{this.props.title}</h3>
<div className="md-body">
{this.props.content}
<i className="md-close close ion ion-close"></i>
</div>
Tabs = React.createClass({
tabClick (tab) {
this.setState({
activeTabIndex : tab.props.tabIndex
});
},
getInitialState () {
return {
activeTabIndex : 0
};
Table = React.createClass({
mixins : [React.addons.PureRenderMixin],
/**
* Sets the components key and dir state
* @event the synthetic event from ReactJS
*/
setSortKey (event) {
//Get the key from the target element
let key = event.target.getAttribute('data-sortkey');
//Set the state
Tabs = React.createClass({
/**
* Sets the activeTabIndex state
* @index the index you would like to set to active
*/
setActiveTab (index) {
this.setState({
activeTabIndex : index
});
},
Dropdown = React.createClass({
componentDidMount() {
document.addEventListener('click', this.outSideClick, false);
},
componentWillUnmount: function () {
document.removeEventListener('click', this.outSideClick, false);
},
outSideClick (event) {
if (ReactDOM.findDOMNode(this).contains(event.target)) {
return;
_.mixin({
get: function (obj, key) {
var type = typeof key;
if (type == 'string' || type == "number") {
key = ("" + key).replace(/\[(.*?)\]/,/\[(.*?)\]/, function (m, key) { //handle case where [1] may occur
return '.' + key.replace(/["']/g,/["']/g, ""); //strip quotes
}).split('.');
}
for (var i = 0, l = key.length; i < l; i++) {