Skip to content

Instantly share code, notes, and snippets.

View alisterlf's full-sized avatar
👋

Álister Lopes Ferreira alisterlf

👋
View GitHub Profile
@bmaupin
bmaupin / epub.css
Last active January 27, 2022 15:31
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "DejaVuSansMono", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
@litera
litera / Angular.Filter.Format.js
Created March 19, 2014 03:25
string.Format for AngularJS
/* AngularJS string.Format filter
*
* This filter provides string variable replacement similar to C# string.Format("{0}", "something");
*
* Usage: {{ "From model: {0}; and a constant: {1};" | format:model.property:"constant":...:... }}
*/
(function (angular) {
angular
@pies
pies / ExcelFormulas.js
Created November 29, 2012 04:55
Few Excel formulas - PMT, PPMT, XIRR - expressed in Javascript
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
@Godefroy
Godefroy / removeaccents.js
Created April 7, 2012 16:03
String prototype function to remove accents
String.prototype.removeAccents = function(){
var t = this,
a = {
'œ' : 'oe',
'Œ' : 'Oe',
'æ' : 'ae',
'Æ' : 'Ae',
'[ÀÁÂÃÄÅĀĂǍẠẢẤẦẨẪẬẮẰẲẴẶǺĄ]' : 'A',
'[àáâãäåāăǎạảấầẩẫậắằẳẵặǻą]' : 'a',
'[ÇĆĈĊČ]' : 'C',
@intelekshual
intelekshual / get-elements-by-attribute.js
Created November 4, 2011 01:39
getElementsByAttribute
function getElementsByAttribute(tag, name, value) {
var elements = (tag == "*" && document.all) ? document.all : document.getElementsByTagName(tag),
matches = [],
re = (typeof name !== "undefined") ? new RegExp("(^|\\s)" + value + "(\\s|$)", "i") : null,
current,
attribute;
for (var i = 0; i < elements.length; i++) {
current = elements[i];
attribute = current.getAttribute && current.getAttribute(name);