This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.manualLowercase = function(s) { | |
return (typeof s === 'string') ? s.replace(/[A-Z]/g, function (ch) { | |
return String.fromCharCode(ch.charCodeAt(0) | 32) | |
}) : s; | |
}; | |
String.prototype.manualUppercase = function (s) { | |
return (typeof s === 'string') ? s.replace(/[a-z]/g, function (ch) { | |
return String.fromCharCode(ch.charCodeAt(0) & ~32) | |
}) : s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resolver = { | |
crew: function ($q, $route, $timeout, starTrekResource) { | |
//... | |
} | |
} | |
resolver.crew.$inject = ['$q','$route, '$timeout',' 'starTrekResource']; | |
$routeProvider.when("/:starship", { | |
templateUrl:"partials/starship.html", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A generic confirmation for risky actions. | |
* Usage: Add attributes: ng-really-message="Really?" ng-really-click="takeAction()" function | |
*/ | |
angular.module('app').directive('ngReallyClick', [function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
element.bind('click', function() { | |
var message = attrs.ngReallyMessage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('dragDrop', []); | |
app.directive('draggable', function() { | |
return function(scope, element) { | |
// this gives us the native JS object | |
var el = element[0]; | |
el.draggable = true; | |
el.addEventListener( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isMobile = function() { | |
return !!navigator.userAgent.match(/Android|BlackBerry|BB10; Touch|iPhone|iPad|iPod|Opera Mini|IEMobile/i); | |
}; | |
Array.prototype.clone = function () { | |
return Array.prototype.slice.call(this, 0); | |
}; | |
Array.prototype.clear = function() { | |
this.length = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<div class="steps"> | |
<a href="" class="step step1">1</a> | |
<div class="line line1"></div> | |
<a href="" class="step step2">2</a> | |
<div class="line line2"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var focus = function(input) { | |
if (typeof input.selectionStart === "number") { | |
input.selectionStart = input.selectionEnd = input.value.length; | |
} else if (typeof input.createTextRange !== "undefined") { | |
input.focus(); | |
var range = input.createTextRange(); | |
range.collapse(false); | |
range.select(); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('unsafe', function($sce) { | |
return $sce.trustAsHtml; | |
}); |
I hereby claim:
- I am epokk on github.
- I am epokk (https://keybase.io/epokk) on keybase.
- I have a public key whose fingerprint is 9622 0F0C EF0C 7089 FE61 FDAD 925A DE16 89E0 2EC0
To claim this, I am signing this object: