Skip to content

Instantly share code, notes, and snippets.

/*ELOQUENT JAVASCRIPT*/
// forEach
function forEach(array, action) {
for (var i = 0; i < array.length; i++)
action(array[i]);
}
// map
function map(func, array) {
var result = [];
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
autocmd BufWritePre * :call TrimWhiteSpace()
function TrimEndLines()
let save_cursor = getpos(".")
:silent! %s#\($\n\s*\)\+\%$##
call setpos('.', save_cursor)
endfunction
# ~/.virtualenvs/circus/bin/postactivate
#! /bin/bash
export BASE_URL="http://localhost:8000"
export DJANGO_SETTINGS_MODULE="circus.settings"
# ~/.virtualenvs/postdeactivate
#! /bin/bash
unset BASE_URL
unset DJANGO_SETTINGS_MODULE
<!--[if lte IE 8]>
{% if DEVELOPMENT %}
<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
{% endif %}
<![endif]-->
# where user_roles is an array filled with strings
# option's value and text will both be role
<select ng-model="selectedUser.role" ng-options="role for role in user_roles">
</select>
# where supported_languages is an array filled with objects
# option's value will be language.code and option's text will be language.label
<select ng-model="selectedUser.language_code"
watch: {
scripts: {
files: [js + '/**/*.js'],
tasks: ['concat:js'],
},
handlebars: {
files: ['templates/**/*.hbs'],
tasks: ['handlebars'],
},
css: {
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<script src="http://code.angularjs.org/angular.js"></script>
<body>
<div id="angular-free">
I am a completely inert {{double-curly}}. Angular can't touch this!
Free to do whatever jQuery craziness strikes your fancy.
Or hell, add a backbone app here.
</div>
<!-- don't add ng-app="angular-app" - that's what kicks off auto-bootstrapping!!! -->
@eupharis
eupharis / droppable_directive.html
Last active December 21, 2015 11:59
groups idea
<div ng-repeat="group in groups">
<div data-group={{group.id}} group-droppable>{{group.name}}</div>
<div ng-repeat="pak in paks" draggable>
<!-- ... pak display -->
</div>
</div>
<script>
<!-- angular directive boilerplate -->
#!/bin/bash
grep -ri $1 $2 --exclude-dir={lib,css,stylesheets} --exclude=*{app.min.js,app.js,templates.js} --color
@eupharis
eupharis / accordion-icon-switch.js
Last active December 24, 2015 02:59
Bootstrap Accordion Icon Switch
/*
Updates An Accordion's Icon.
Just include:
<span class="accordion-icon">+</span>
To your accordion-toggle!
*/
"use strict";
$(function() {