Skip to content

Instantly share code, notes, and snippets.

@toddsby
toddsby / adduser.sh
Created February 26, 2017 02:41
osx adduser bash script
#!/bin/bash
# =========================
# Add User OS X Interactive Command Line
# =========================
getHiddenUserUid()
{
local __UIDS=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ugr)
#echo $__UIDS
@toddsby
toddsby / osx-nginx-1.10.3-w-h2.sh
Last active March 6, 2018 16:25
osx mavericks - build nginx 1.10.3 from source - with http2
#!/bin/bash
# Build Nginx 1.10.3 on Mac OS X Mavericks (10.9)
# This script was created by Kevin Worthington - http://kevinworthington.com/ - 28 October 2013
# Original article at: http://kevinworthington.com/nginx-for-mac-os-x-yosemite-in-2-minutes/
# Modifed by Drew Toddsby - 2 February 2017
# This useful script is provided for free, but without warranty. Use at your own risk.
# By downloading this script you agree to the terms above.
// Brightness math based on:
// http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
@function sqrt ($r) {
$x0: 1;
$x1: $x0;
@for $i from 1 through 10 {
$x1: $x0 - ($x0 * $x0 - abs($r)) / (2 * $x0);
$x0: $x1;
@toddsby
toddsby / index.js
Created October 21, 2016 00:41 — forked from MoOx/index.js
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@toddsby
toddsby / siren-client.js
Created October 20, 2016 18:50
Siren Client example AngularJS
/**
* Created by phoehne on 4/3/14.
*/
var sirenModule = angular.module('siren', []);
sirenModule.service('SirenService', ["$http", "$q", function($http, $q) {
this.configureMethods = function(rawResonse) {
var self = this;
@toddsby
toddsby / Secure Sessions Howto
Created October 14, 2016 15:42 — forked from nikmartin/A: Secure Sessions Howto
Secure sessions with Node.js, Connect, and Nginx as an SSL Proxy
Secure sessions are easy, but it's not very well documented, so I'm changing that.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT]
To do this, here's what you need to do:
@toddsby
toddsby / cUN.js
Created October 5, 2016 17:33
ES6 javascript helper to check for undefined, null, or empty values
/*
* cUN: helper to check for undefined, null, or empty values
**/
export const cUN = ( value ) => {
if ( type of value == 'undefined' || value === '' || value === null || value !== value ) return true;
else return false;
}
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@toddsby
toddsby / pr.md
Created September 25, 2016 16:37 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@toddsby
toddsby / multiple_ssh_setting.md
Created September 24, 2016 15:21 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"