Skip to content

Instantly share code, notes, and snippets.

View starsinmypockets's full-sized avatar

Paul Walker starsinmypockets

View GitHub Profile
@starsinmypockets
starsinmypockets / functional_1.js
Last active July 3, 2017 17:12
Javascript - functional paradigm excercises
// Recursively find the sum of nested arrays
// NOTE: Need to pass initial value for accumulator!!
// Otherwise, the accumulator is initialized as the first
// element of the `data` array, `[1,2,3]` - NOT what we want!
let data = [ [1,2,3], [2,3,4], [3,4, [5,6,7,8]]]; // 48
let recSum = function (acc, cur) {
if (Array.isArray(cur)) cur = cur.reduce(recSum, 0);
return acc + cur;
@starsinmypockets
starsinmypockets / Enhance.js
Created November 22, 2016 02:28 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
{
"title": "Hello World",
"components": [
{
"type": "Chart",
"cardStyle": "Chart",
"header": "My Pie Chart",
"data": [
[
{
{
title: 'Hello World',
components: [
{
type: 'Chart',
cardStyle: 'Chart',
header: 'My Pie Chart',
data: [[{x: 1, y: 40}, {x: 2, y: 40}, {x: 3, y: 20}]],
dataHandlers: ['NVD3.toPieChartSeries'],
settings: {
{
"title": "Hello World",
"components": [{
"type": "Chart",
"cardStyle": "Chart",
"header": "My Pie Chart",
"data": [
[{
"x": 1,
"y": 40
export var settings = {
title: 'Hello World',
components: [
{
type: 'Chart',
cardStyle: 'Chart',
header: 'My Pie Chart',
data: [[{x: 1, y: 40}, {x: 2, y: 40}, {x: 3, y: 20}]],
dataHandlers: ['NVD3.toPieChartSeries'],
settings: {
{
"version": "2",
"header": {
"title": "Parking Violations",
"description": "This data set reflects parking violations reported by authorized agencies in Philadelphia. The data represented below is a sample of parking violations occurring between 2012-2015 with license plate numbers anonymized for privacy.",
"navigation": [
{
"label": "Download",
"url": "https://data.phila.gov/api/views/3bxz-a5sb/rows.csv?accessType=DOWNLOAD&bom=true"
}
# GENERAL
alias aliases="compgen -a" #list all aliases
alias rmlasthost="sed -i '' -e '$ d' ~/.ssh/known_hosts" #remove last host key entry
alias ls="ls -a"
# ANSIBLE
alias apb="ansible-playbook"
@starsinmypockets
starsinmypockets / .vimrc
Created December 23, 2015 14:47
Vim jawns
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
set titlestring=%F\ %a%r%m
let titlelen=70
set title
@starsinmypockets
starsinmypockets / lvl_mongo_qs.txt
Created November 24, 2015 15:30
levelware useful queries
db.userdocs.remove({parties : { $elemMatch : { email : 'ras.mashramani@gmail.com'}}})
db.userdocs.remove({parties : { $elemMatch : { email : 'ilegalimex@gmail.com'}}})