Skip to content

Instantly share code, notes, and snippets.

View kevinold's full-sized avatar

Kevin Old kevinold

View GitHub Profile
@kevinold
kevinold / gist:368387f8da42ce7d24179f3a14359051
Created September 27, 2016 17:26 — forked from negativo/gist:152716565e4091eb9039f55f9781badd
send sms with aws provider in NODEJS
var AWS = require('aws-sdk');
AWS.config.region = 'your aws region';
AWS.config.update({
accessKeyId: "your access id",
secretAccessKey: "your secret access key",
});
var sns = new AWS.SNS();
var params = {
@kevinold
kevinold / general-purpose-reducers.js
Created July 5, 2016 17:17 — forked from crisu83/general-purpose-reducers.js
General-purpose reducers for Redux.
/**
* This gist was inspired by the video course titled "Building React Applications with Idiomatic Redux"
* available on Egghead.io by the creator of Redux, Dan Abramov.
*
* The purpose of this gist is to demonstrate general purpose reducers that can be used via Redux's combineReducers
* to compose more complex reducers and therefore maximize code reuse.
*
* Feedback is more than welcome!
*
* @author Christoffer Niska <[email protected]>
{
"lambda": {
"envVars": [],
"deploy": false,
"package": {
"optimize": {
"builder": "browserify",
"minify": true,
"ignore": [],
"exclude": [
/* This is intentionally blank just and exists to secure a decent gist name */
import { connect } from 'react-redux';
import { createSelectorCreator } from 'reselect';
import { reduxForm } from 'redux-form';
function memoize(func, equalityCheck = (a, b) => a === b) {
const lastArgsCache = {};
const lastResultCache = {};
return (...args) => {
const memoizeKey = args.pop();
const lastArgs = lastArgsCache[memoizeKey];
@kevinold
kevinold / Open in Chrome from Safari.scpt
Created September 24, 2015 18:37 — forked from sillygwailo/Open in Chrome from Safari.scpt
Open in Chrome from Safari and vice versa
-- from http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/
-- install FastScripts http://www.red-sweater.com/fastscripts/ and place this AppleScript in the Scripts applications folder for Google Chrome.
-- For me that was ~/Library/Scripts/Applications/Safari
-- You can then assign it a keyboard shortcut. I went with Cmd-Shift-C
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
tell application "Google Chrome"
@kevinold
kevinold / openinfirefox.scpt
Created September 24, 2015 18:24 — forked from fryn/openinfirefox.scpt
Open Chrome Tab in Safari or Firefox
-- Open URL of currently active Google Chrome tab in Firefox
--
-- Open Automator -> Service.
-- At the top, select "no input" and Google Chrome.
-- Find "Run AppleScript" in the library, and drag it to the right.
-- Paste this code in the textbox.
-- Save this script as "Open in Firefox".
-- Open System Preferences -> Keyboard -> Keyboard Shortcuts -> Services.
-- Assign a shortcut to "Open in Firefox".
@kevinold
kevinold / pedantically_commented_playbook.yml
Last active August 29, 2015 14:27 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
'use strict';
// Adapted from https://github.com/ColCh/jest-webpack/blob/f8e02b7a51da48c55395392e61d9c03789e43911/preprocessor.js
// Packages these tests with deps with webpack https://github.com/ninjapanzer/Backbone-Flux-React-Webpack/tree/master/__tests__
var webpack = require('webpack');
var MemoryFileSystem = require('memory-fs');
var fs = new MemoryFileSystem();
class UtilityController extends BaseController {
public function upload()
{
$file = Input::file('Filedata');
$name = Date("now").'-'.$file->getClientOriginalName();
$uploadSuccess = $file->move(public_path().'/uploads',$name);
if( $uploadSuccess ) {
return Response::json(array(
"status"=>"200",