A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
# Edit here - set path to you directory with config.json & fonts | |
FONT_DIR ?= ./assets/vendor/fontello/src | |
### Don't edit below ### | |
FONTELLO_HOST ?= https://fontello.com | |
fontopen: | |
@if test ! `which curl` ; then \ |
//Based on http://www.samliew.com/icval/ | |
function validateNRIC(str) { | |
if (str.length != 9) | |
return false; | |
str = str.toUpperCase(); | |
var i, | |
icArray = []; | |
for(i = 0; i < 9; i++) { |
window.onload = function () { | |
var objDiv = document.getElementById("idOfYourDiv"); | |
objDiv.scrollTop = objDiv.scrollHeight; | |
} |
app.directive("clickToEdit", function() { | |
var editorTemplate = '<div class="click-to-edit">' + | |
'<div ng-hide="view.editorEnabled">' + | |
'{{value}} ' + | |
'<a ng-click="enableEditor()">Edit</a>' + | |
'</div>' + | |
'<div ng-show="view.editorEnabled">' + | |
'<input ng-model="view.editableValue">' + | |
'<a href="#" ng-click="save()">Save</a>' + | |
' or ' + |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
angular.module('angularApp'). | |
directive('dt', function(){ | |
return { | |
require: '?ngModel', | |
restrict: 'A', | |
link: function ($scope, element, attrs, controller) { | |
var updateModel, onblur; | |
if (controller !== null) { |