Skip to content

Instantly share code, notes, and snippets.

@mikeerickson
mikeerickson / angular-node-cors.js
Last active December 25, 2015 00:29 — forked from dirkk0/gist:5967221
Allowing CORS with AngularJS and Node/Express
// in AngularJS (client)
myApp.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
// in Express/nodeJS
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@mikeerickson
mikeerickson / chrome-dev-setup
Created November 3, 2013 22:01
Chrome Development Enviornment
Introduction
------------
Earlier today, I posted a screenshot of my current development environment using Chrome and figured I would put together a little more information about what all is going on here.
My Setup (I am a Dark Theme fan)
--------------------------------
As a recap, here is the screenshot I posted:
@mikeerickson
mikeerickson / l4-presenter-template.php
Last active December 28, 2015 01:58
Example Laravel 4 Presenter Template, supporting calling standard $table->field properties, or $table->method, or $table->method(parameter) http://paste.laravel.com/16LT
RAWFORKNEW
<?php
/* --- Laracasts Presenters Lesson Homework --- */
/*
In order to provide the ability to call a method on the object we need the __call() method
If we convert the existing __get() method to a __call() method then we can no longer call the method as a property
ie. $user->gravitar will throw an error that the property does not exist
So we need both __call() and __get()
For flexibility the __get() method will handle properties but will also convert $user->gravitar to $user->gravitar()
If no method exists then __get() will call it as a property
@mikeerickson
mikeerickson / gu-script.txt
Last active December 28, 2015 13:19
Simple bash function to shorten git commit calls (using 'gu' as function call) $ gu --- uses default message 'Code Update' $gu "Custom Message"
gu () {
if [ -z "$1" ]; then msg="code update"; else msg=$1; fi
git add . -A && git commit -m "$msg" && git push
}
@mikeerickson
mikeerickson / laravel-setup.sh
Last active December 30, 2015 12:28
Laravel Setup Script to craft new Laravel 4.1 (has drop down support for Laravel 4.0.x as well) application and optionally install a suite of commonly used developer tools. In addition, provides support for creating a new MySQL database as well as setting up a new git repository.
#!/bin/bash
# Current Version 0.0.9
# dont forget to create write permissions on this file
# 2013-12-20: 0.0.9
# - refactored .bowerrc to store in 'lib' instead of components
# 2013-12-16: 0.0.8
# - Updated Gruntfile.js and .jshint gist referece
@mikeerickson
mikeerickson / Gruntfile.js
Last active December 31, 2015 02:39
Basic Gruntfile.js template used in all projectsUse following command to bring in all plugins (and their associated depencencies) - npm install grunt grunt-contrib-less grunt-contrib-cssmin grunt-contrib-uglify grunt-contrib-watch grunt-phpunit --save-dev
module.exports = function(grunt){
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
conf: {
js_files: 'public/js/**/*.js',
css_files: 'public/css/**/*.css',
css_path: 'public/css/',
test_files: 'app/tests/*.php',
@mikeerickson
mikeerickson / package.json
Last active December 31, 2015 02:39
Starter package.json file - Download file - Set appname and version properties - Call npm install - Get to work!
{
"name": "laravel-rest",
"version": "0.0.1",
"description": "Sample Laravel Restified Application",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "~0.4.2"
},
"devDependencies": {
"grunt": "~0.4.2",
@mikeerickson
mikeerickson / .jshintrc
Last active December 31, 2015 10:49
Default .jshintrc used by Sublime jsHint plugin
{
"curly": true, // true: Require {} for every new block or scope
"eqeqeq": true, // true: Require triple equals (===) for comparison
"immed": true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"latedef": true, // true: Require variables/functions to be defined before being used
"newcap": true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"sub": true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"undef": true, // true: Require all non-global variables to be declared (prevents global leaks)
"boss": true, // true: Tolerate assignments where comparisons would be expected
@mikeerickson
mikeerickson / laravel-setup-imgages.txt
Created December 15, 2013 17:47
Images used by laravel-setup injection
<h3>
<a href="http://http://getbootstrap.com" target="_blank"><img src="http://codedungeon-public.s3.amazonaws.com/bootstrap-logo.jpg" width="65%" height="65%"></a>
<a href="http://www.gruntjs.com" target="_blank"><img src="http://codedungeon-public.s3.amazonaws.com/grunt-logo.png" width="85%" height="85%"></a>
<a href="http://www.lesscss.org" target="_blank"><img src="http://codedungeon-public.s3.amazonaws.com/less-logo.png"></a>
<a href="http://bower.io" target="_blank"><img src="http://codedungeon-public.s3.amazonaws.com/bower-logo.png" width="55%" height="55%"></a>
<a href="https://github.com/sebastianbergmann/phpunit/" target="_blank"><img src="http://codedungeon-public.s3.amazonaws.com/phpunit-logo.jpg"></a>
</h3>