Skip to content

Instantly share code, notes, and snippets.

View che-wf's full-sized avatar
👨‍💻
Working

Josh che-wf

👨‍💻
Working
View GitHub Profile
@che-wf
che-wf / index.html
Created August 20, 2015 04:49
Convert Time from Argentine Time to Local Time
<html>
<head>
<title>Convert Time from Argentine Time to Local Time</title>
</head>
<body>
<span id="time"></span>
<script>
function toLocalTime(time) {
var splitTime = time.split(':');
var currDate = new Date();
@che-wf
che-wf / copyright.html
Last active December 8, 2017 14:00
Add Copyright Year to Your Site Properly Using JavaScript/jQuery
@che-wf
che-wf / ngFindDupes.js
Last active July 22, 2016 17:11
Angular Find Duplicates in Array
Array.prototype.findDupes = function () {
return this.reduce(function (accum, current) {
if (angular.lowercase(accum).indexOf(
angular.lowercase(current)) < 0) {
accum.push(angular.lowercase(current));
}
return accum;
}, []);
};
@che-wf
che-wf / ngEnter.js
Created May 25, 2015 20:42
ngEnter
/* Directive for Hitting Enter for Search */
function ngEnter() {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if (event.which === 13) {
scope.$apply(function () {
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@che-wf
che-wf / superscriptAllTheThings.js
Last active April 22, 2016 13:35
Superscript all Trademark, Registered, and Copyright scripts (unless already superscripted)
$('body :not(script,sup)').contents().filter(function() {
return this.nodeType === 3;
}).replaceWith(function() {
return this.nodeValue.replace(/[™®©]/g, '$&');
});
@che-wf
che-wf / flipCounterCountingUp.js
Last active April 22, 2016 13:35
Flip Counter Counting Up
var startD = new Date("April 7, 2015")/3600;
var currD = new Date()/3600;
var diffD = Math.abs(currD - startD);
var time = Math.ceil(diffD)+10000;
var clock = $('.flip-counter').FlipClock(time, {
clockFace: 'Counter'
});
setTimeout(function() {