Skip to content

Instantly share code, notes, and snippets.

View karatechops's full-sized avatar
🐙

Alex Mejias karatechops

🐙
View GitHub Profile
@karatechops
karatechops / ternary.jsx
Created January 16, 2017 21:08
Ternary style
const assets = (this.props.posts && this.props.posts.length > 0)
? this.props.posts.map(({_id, path, title}) =>
<AssetTile
id={_id}
title={title}
path={path}
key={`asset-${_id}`}
size="small"
showControls={false}
onClick={this.props.onAssetSelect.bind(this, {_id, path, title})}
var express = require('express');
var passport = require('passport');
var passportSaml = require('passport-saml');
var logger = require('morgan');
var bodyParser = require('body-parser');
var fs = require('fs');
var https = require('https');
var app = express();
app.use(logger('common'));
@karatechops
karatechops / removeDuplicates.js
Created August 3, 2017 18:40
Javascript - remove duplicates from array of objects.
const testArray = [
{
email: 'test@test.com',
name: ''
},
{
email: 'test@test.com',
name: ''
},
{
@karatechops
karatechops / flattenNestedArrays.js
Last active August 4, 2017 18:55
Flatten undetermined amount of nested arrays
// AKA yoDawgIHeardYouLikeArrays.js.
const flattenArrayLoop = (itemToFlatten, callback) => {
if (itemToFlatten instanceof Array) {
itemToFlatten.map((nestedItem, nestedItemIndex) => {
if (nestedItem instanceof Array) {
// This is a nested array, attach this loop to it.
flattenArrayLoop(nestedItem, callback);
} else {
callback(nestedItem);
@karatechops
karatechops / Reports.js
Last active August 4, 2017 20:41
Node/Express xlsx package class example
// XLSX class for creating excel reports.
import XLSX from 'xlsx';
export default class Workbook {
constructor() {
this.SheetNames = [];
this.Sheets = {};
this.addSheetName = this.addSheetName.bind(this);
@karatechops
karatechops / MobileShow.js
Last active September 15, 2017 13:33
Removing props from styled components to avoid DOM propagation.
import React from 'react';
import styled from 'styled-components';
import Box from 'grommet/components/Box';
export const MobileShow = styled(
({ maxWidth, children, ...rest }) => // eslint-disable-line
<Box {...rest}>{children}</Box>
)`
display: none;
@karatechops
karatechops / test.md
Last active January 5, 2018 17:36
Test markdown

test

cool.

@karatechops
karatechops / bc-app.md
Created January 18, 2018 21:12
Brand Central Apps

Brand Central - Application Review

Brand Central

Brand Central CMS

  • package name: brand-central-cms
  • purpose: Content storage, editing, API, user session management.
/*
* I have more visual feedback than technical. My main concern technically is your route changes render a different
* view then reload the page. It looks like JS is handling your route changes then it's pushing to the browser
* to change the page. I'd have to see your JS to show you where that's happening but if it's a single page
* app then Javascript should be handling the page changes not the browser. This generally happens with
* how the user handles route changes url replace vs push.
*
* I would disable your service worker, you dont need that shit. It's too confusing for a beginner, its confusing for me.
*/