Skip to content

Instantly share code, notes, and snippets.

@codeopensrc
codeopensrc / paramHelper.MD
Last active April 15, 2016 23:31
Parameter type checking in JS

A helper parameter check for functions in JS

TODO: Turn into a .js file or npm module
TODO: Improve the single object version and demonstrate good usage with function parameters
TODO: Seperate arrays from objects

Supports: string, number, object, function, boolean

3rd iteration

  • This would/will be the npm module
@codeopensrc
codeopensrc / KeyBoardCheatSheet.MD
Last active May 14, 2016 03:49
Mac (currently) keyboard shortcuts I use.

Mac OSX

NOTE - Currently this is a non-exhaustive list. I will add more each day.

  • A lot of these are built-in and some are my personal shortcuts. In the future I will mark defaults vs. changed
  • On my Mac, the CMD key and CTRL key are swapped, so whererever you see CMD, it will be the default CTRL and vice versa
  • For MY sanity, I kept it that way so I am not second guessing myself.
Terminal:
Key Command
@codeopensrc
codeopensrc / Useful.md
Last active June 3, 2016 22:30
Articles/links to useful toolls/stuff I don't feel like bookmarking and feel like sharing.
@codeopensrc
codeopensrc / GitServeRepos.sh
Last active June 8, 2016 18:18
Quickly serve folders/git repos to others privately
# Linux/Mac - No windows
# Quickly share your code/script with others that have ssh access to the same server.
# Include one or both functions inside your ~/.bash_aliases.
# `gitinitrepo` needs `gitserverepo`, otherwise it just inits a git repo
# To use, change the SERVER1, SERVER2, SHORTNAME1, SHORTNAME2 variables to whatever you want
# adding or removing if you want as well.
# Then inside the folder without a git repo attached
@codeopensrc
codeopensrc / RealmWrapper.md
Last active April 15, 2019 02:13
A javascript wrapper for the RealmDB node module used in React Native.

My RealmWrapper.js file. Uses RealmSchema.js for the schema.

You can find the "realmSchema.js" here and examples here

'use strict';

import Realm from 'realm';
import Schemas from "./realmSchemas.js";
const version = 51;
@codeopensrc
codeopensrc / RealmSchema.md
Last active June 10, 2016 19:47
Example schema for Realm used in React Native

Schema example to my RealmWrapper.js and RealmExamples.md

You can find the RealmWrapper here and RealmExamples here

'use strict';


class Assigned {}
@codeopensrc
codeopensrc / RealmExamples.md
Last active June 10, 2016 19:50
Examples using my RealmWrapper.js and RealmSchema.js

Examples for my RealmWrapper.js and RealmSchema.js

You can find the RealmWrapper here and RealmSchema here

//addRealmListener(fn)
this.realm.addRealmListener(this.updateImgs.bind(this));
@codeopensrc
codeopensrc / Dockerfile
Created November 23, 2016 00:44
Base Dockerfile for React/Webpack/PM2
FROM node
RUN apt-get update && apt-get install -y \
build-essential \
apt-utils \
openjdk-7-jdk \
vim \
git
RUN npm i node-gyp -g
@codeopensrc
codeopensrc / gist:98c080388d1f8b892d381b8eea25b2e6
Last active February 22, 2017 00:00
Docker + UFW + Older Linux OS

NOTE:

This solution works however, your containers can no longer connect to the outside world. Currently searching for a solution where I can whitelist ips to specific ports on an external server while blocking all other external ips.

Example: 2-4 web apps accessable to the internet, 1 mongo container. I would like to connect to the mongo container from my ip and from the containers, but disallow anyone else to connect to the mongo container

Currently its possible, but all containers lose ability to ping/connect outside the container with --iptables=false Otherwise all containers are exposed.

@codeopensrc
codeopensrc / git.MD
Last active January 28, 2017 01:12
Quick notes on Setting up git:// and git user

Note:

This is my personal preference which may be different from yours. I'm choosing to do the following:

  • Let any user within the git group that is NOT the git user, full access to do what they wish with the repositories, including rename, delete, and move.
    • It is possible to only allow the git group to only modify items within the repositories, but I chose not to at this time (its only me anyway). I'll append how to do this at the end at a later time.
  • Let the git user have only enough access to push/pull repositories, list the repositories, and add their public ssh key to git users .ssh/authorized_keys directory.
  • Allow only the repo/root/sys admin to place repos in the location to serve them publically.
  • Allow only specific repo's to be served publically in a seperate folder.
  • Have the shortest url using scp syntax git@serverip:repo.git and git://serverip:repo.git.
  • Make sure all permissions we set perfectly so from inception of creating the repo, to pushing for the 100th time,