Skip to content

Instantly share code, notes, and snippets.

View Vitzkrieg's full-sized avatar

Dustin Vietzke Vitzkrieg

View GitHub Profile
@AmmarCodes
AmmarCodes / get-latest-videos.js
Last active March 20, 2019 17:17 — forked from douglasmiranda/get-latest-videos.js
Get the latest videos from a YouTube channel with jQuery.
function show_my_videos(data){
html = ['<ul id="videos">'];
$(data.data.items).each(function(item) {
id = item.id;
description = item.title;
html.push('<iframe width="560" height="315" src="//www.youtube.com/embed/'+ id +'" frameborder="0" allowfullscreen></iframe>');
});
$("#videos").html(html.join(''));
}
// Replace [YOUTUBE_CHANNEL] with the channel you want
@devfred
devfred / Number.prototype.formatMoney.js
Last active April 3, 2018 17:25
javascript: Restrict all number inputs to use only digits, commas, periods
Number.prototype.formatMoney = function(c, d, t){
var
n = this,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "," : d,
t = t == undefined ? "." : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");