Skip to content

Instantly share code, notes, and snippets.

View evillemez's full-sized avatar

Evan Villemez evillemez

  • Global Professional Search
  • Washington, DC
View GitHub Profile
@evillemez
evillemez / wait-groups.go
Created October 16, 2016 00:50
Playing with WaitGroup in nested goroutines
package main
import (
"crypto/rand"
"fmt"
"math/big"
"os"
"sync"
"time"
)
@evillemez
evillemez / gist:6464513
Last active March 4, 2018 08:27
A better way to illustrate an example RESTful server in PHP for a demo with angular.js.
@evillemez
evillemez / keybindings.json
Created July 19, 2017 20:09
Custom VSCODE keybindings for Ubuntu
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+m",
"command": "editor.action.jumpToBracket",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+\\",
"command": "-editor.action.jumpToBracket",
@evillemez
evillemez / example.js
Created October 16, 2016 01:32
This was an old hacky attempt at a promise-based API for running any function in a web worker. Never got around to fleshing it out.
//Code for async web worker
var fibonacciWorkerTask = function(iterations) {
var first,second,add;
for (var i=0; i<iterations; i++) {
if (i === 0) {
first = 1;
second = 2;
}
@evillemez
evillemez / gist:8024315
Created December 18, 2013 15:32
On deploying apps w/ Symfony and Angular.js

Project Deployment with Symfony2 & Angular.js

Symfony2 and Angular.js make a great, robust combintaion. Integrating them isn't immediately obvious, however. Both communities come with their own standards and suite of tools for managing the development process, and sometimes those tools conflict.

On the Symfony side, you mainly deal with composer for managing your dependencies, a few Symfony commands in your project, and any other tools you add into the mix, like phpunit.

On the Angular side, you'll probably end up using npm, bower and probably grunt for automating some of the pain.

The short answer

@evillemez
evillemez / clean-csv.php
Created February 25, 2016 16:34
simple script to clean a csv file that has an expected structure
#!/usr/bin/env php
<?php
// Note: this script assumes a CSV structure of:
// email,firstName,lastName
//
// The script dudupes by email and trims all fields. Rows
// missing an email are discarded. Validity of email is otherwise
// not checked.
//
@evillemez
evillemez / .gitignore
Created September 29, 2011 00:46
GIT Ignore for Unity
Temp/
Library/
obj/
*.svd
!Library/*.asset
!Library/AssetImportState
!Library/AssetVersioning.db
!Library/BuildPlayer.prefs
!Library/ScriptMapper
@evillemez
evillemez / shaded-bg-columns.less
Created July 12, 2015 19:58
Responsive full-width shaded left column for the Bootstrap 3 grid system
.shaded-bg-calc(@col) {
@shaded-bg-calc-xs: percentage((@col / @grid-columns));
@shaded-bg-calc-sm: ~"50% - (@{container-sm}/2) + ((@{container-sm} * @{col})/@{grid-columns})";
@shaded-bg-calc-md: ~"50% - (@{container-md}/2) + ((@{container-md} * @{col})/@{grid-columns})";
@shaded-bg-calc-lg: ~"50% - (@{container-lg}/2) + ((@{container-lg} * @{col})/@{grid-columns})";
}
.shaded-bg-xs-column(@col, @leftColor, @rightColor) {
.shaded-bg-calc(@col);
@evillemez
evillemez / gist:cbde6b26f0bafe72f41a
Created August 25, 2014 16:14
An API for validation that I would like...
#empty validator
validator = new Validator()
#custom app validator
validator.constraint 'unique-name', (val, ops = {}) ->
namelist = [] #... array of names in system
return "Name already exists!" if namelist.indexOf val > -1
return true
#another custom validator

AngularStrap Modal Wrapper

This describes a provider/service for wrapping the AngularStrap $modal service. It allows for somewhat easier programatic usage.

Usage

First, you define a modal using the provider. Modals are named, and have default configuration for the underlying $modal service:

angular.module('app', ['app.modals']).config (modalsProvider) ->