Skip to content

Instantly share code, notes, and snippets.

@boneskull
boneskull / angular-ui-0.3.1.js
Created August 7, 2013 21:48
cobbled together uiSelect2 to work with ngOptions
/**
* Enhanced Select2 Dropmenus
*
* @AJAX Mode - When in this mode, your value will be an object (or array of objects) of the data used by Select2
* This change is so that you do not have to do an additional query yourself on top of Select2's own query
* @params [options] {object} The configuration options passed to $.fn.select2(). Refer to the documentation
*/
angular.module('ui.directives').directive('uiSelect2', ['ui.config', '$timeout', '$parse', function (uiConfig, $timeout, $parse) {
var options = {};
if (uiConfig.select2) {
@jasonlewis
jasonlewis / create-project.sh
Last active January 25, 2025 20:13
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@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
}
it.only('buildIndex should properly build an index', inject(function (RealtimeQuestion) {
var post = generateMockPost();
var index = generateMockIndex(post);
RealtimeQuestion.buildIndex(post).should.deep.equal(index);
}));
//-------------------------------------------------------------------------
// HELPER FUNCTIONS
//-------------------------------------------------------------------------
var getRandomInt = function(min, max) {
@mikeal
mikeal / gist:7897206
Created December 10, 2013 20:01
Animals for slaughter.

Children are created, raised, cared for and we hope that they will live a long and proud life only to end long after their creator's has ended. They are their creator's legacy.

Your code is not your child, it is an animal raised for slaughter. Your code will die. It will die before your death. Your code's entire purpose is to die. Your code enables some new function and if successful that new function will grow, it will mature, it will eventually outlive the usefullness you've provided. When successful your code creates value that outlives it and the faster the better. When unsuccessful a mercy killing is most appropriate.

Believing that our code is our children makes us territorial, protective. Nobody is allowed to kill it, only improve it. The idea that our code can be perfect, that it can change to handle so many new concerns leads to the birth of frameworks and plugin systems. These systems brutalize creativity by forcing new value to conform to the standards of our aging children.

@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',
@clouddueling
clouddueling / Gruntfile.js
Created December 12, 2013 01:51
my first grunt file.js
//Gruntfile
module.exports = function(grunt) {
//Initializing the configuration object
grunt.initConfig({
// Task configuration
concat: {
options: {
separator: ";\n"
@clouddueling
clouddueling / console.log
Created January 4, 2014 05:59
My only take away from Paul Irish's talk on workflow. Run this in your Chrome console. :)
console.log('%c I AM UNICORN!!!', 'color: #fff; font-size: 30px; font-family: Verdana; text-shadow: 0px 2px 3px #555; padding: 20px 400px; width: 100%; background: #F66 url(rainbow-gradient.jpg); background-image: -moz-linear-gradient( left top, right bottom , from(red), color-stop(16%, orange), color-stop(32%, yellow), color-stop(48%, green), color-stop(60%, blue), color-stop(76%, indigo), to(violet)); /*webkit rainbow gradient*/ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.00, red), color-stop(16%, orange), color-stop(32%, yellow), color-stop(48%, green), color-stop(60%, blue), color-stop(76%, indigo), color-stop(1.00, violet));}');
@laracasts
laracasts / gulpfile.js
Last active February 10, 2024 10:57
Example Laravel-specific Gulpfile from Laracasts.com
var gulp = require('gulp');
var gutil = require('gulp-util');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css')
var coffee = require('gulp-coffee');
var exec = require('child_process').exec;
var sys = require('sys');