Skip to content

Instantly share code, notes, and snippets.

View andriesfilmer's full-sized avatar

Andries Filmer andriesfilmer

View GitHub Profile
@jeffjohnson9046
jeffjohnson9046 / percent-filter.js
Last active September 4, 2020 23:25
Format percentages in AngularJS
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
return $filter('number')(input * 100, decimals) + '%';
};
}]);
@jaxbot
jaxbot / form.html
Last active January 13, 2019 14:11
Node.js recaptcha example 2 (using AJAX instead of forms) https://jaxbot.me/articles/new-nocaptcha-recaptcha-with-node-js-express-12-9-2014
<!doctype html>
<html>
<head>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script>
function registerAPI(form) {
var params = {
username: form.username.value,
password: form.password.value,
email: form.email.value,