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 / 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 / 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 / javascript.json
Last active April 27, 2018 16:04
React & Grommet VS Code Snippets
{
"Console Log": {
"prefix": "cl",
"body": [
"console.log(${1:});"
],
"description": "Console Log"
},
"Console Log ||": {
"prefix": "cl||",
@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.
@karatechops
karatechops / hacking-for-dummies.md
Last active November 2, 2019 19:12
Mac Developer Setup

So you want to learn how to hack?

Then this is not the guide for you. But if you want to learn how to setup your new fancy mac for development you've found the right place.

Terminal for hackers

Just kidding, still for developers. The following steps are taken directly from Wes Bos' Smashing Magazine article.

  • Download and install iTerm2
  • Download and install Xcode, you'll need Xcode's developer tools to accomplish the next step. Be sure to grab the latest release version not beta, we all know mac beta really means pre-pre-alpha.
  • Install ZSH / Oh My ZSH. sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)".
  • Enable hidden folders - in your terminal window run defaults write com.apple.finder AppleShowAllFiles YES then restart your finder by holding option and right clicking the finder icon, cli