Skip to content

Instantly share code, notes, and snippets.

View patrickml's full-sized avatar

Patrick Lewis patrickml

View GitHub Profile
@patrickml
patrickml / javascript.filters.js
Created April 22, 2022 11:18
Javascript Remove Matching Objects from list with .filter()
/**
Problem Statement
Javascript does not have a built in function that removes objects {} from an array with negitive conditions i.e. !=
*/
/* Example of problem */
const myArray = [ { a: 'b', 'b': 'c' }, { a: 'b', 'b': 'd' }];
const filter = { a: 'b', b: 'c'}
const ProxyStore = (values={}, options={}) => new Proxy(
{
__registry: {},
subscribe: function(key, fn) {
this.__registry[key] = [...(this.__registry[key] || []), fn];
},
unsubscribe: function(key, fn) {
this.__registry[key] = this.__registry[key].filter(fn);
},
...values,

Breath

So you are taking on the adventure of creating your first real hackathon experiment, a blood pressure monitor. You have decided to use Meteor JS for you're contribution to the system, the web ui, great choice! I know you will do well. Here are some quick tips and thoughts in order to help bring your blood pressure down. Nothing in this tip list is rock solid, meaning you don't need to follow every bit down to the end. You can write your application how ever you want, just breath, think about what your objective is and let the code flow.

@patrickml
patrickml / Log.txt
Created April 22, 2016 20:51
MeteorJS Application Production Build Time - 4/22/16
START CAPTURE 0 undefined took NaN
| (#1) Profiling: ProjectContext prepareProjectForBuild
START 1 preparing project
START 2 reading project metadata
DONE 2 reading project metadata took 9
START CAPTURE 2 undefined took NaN
START 3 scanning local packages
START 4 looking for packages
DONE 4 looking for packages took 13
START 4 initializing packages
_.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++) {
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;
Tabs = React.createClass({
/**
* Sets the activeTabIndex state
* @index the index you would like to set to active
*/
setActiveTab (index) {
this.setState({
activeTabIndex : index
});
},
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({
tabClick (tab) {
this.setState({
activeTabIndex : tab.props.tabIndex
});
},
getInitialState () {
return {
activeTabIndex : 0
};
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>