Skip to content

Instantly share code, notes, and snippets.

@neilbo
neilbo / medicare_card.js
Created April 17, 2023 20:55 — forked from Ugrend/medicare_card.js
Random Medicare Card Generator
//Reference: http://www.clearwater.com.au/code/provider
const randomMedicareNumber = ()=>{
let sum = Math.floor(Math.random() * 5) +2;
const weights = [1, 3, 7, 9, 1, 3, 7, 9];
let num = [sum]
for(let i = 0 ; i < 7 ; i++){
let n = Math.floor(Math.random()*10)
sum += n * weights[i+1];
@mixin smooth-scrolling() {
overflow-y: scroll; /* has to be scroll, not auto */
-webkit-overflow-scrolling: touch;
}
@include smooth-scrolling();
#!/bin/bash
set -eu
SENTRY_DOWNLOAD_Linux_i686="https://downloads.sentry-cdn.com/sentry-cli/1.44.1/sentry-cli-Linux-i686"
SENTRY_DOWNLOAD_Windows_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.44.1/sentry-cli-Windows-x86_64.exe"
SENTRY_DOWNLOAD_Darwin_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.44.1/sentry-cli-Darwin-x86_64"
SENTRY_DOWNLOAD_Linux_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.44.1/sentry-cli-Linux-x86_64"
SENTRY_DOWNLOAD_Windows_i686="https://downloads.sentry-cdn.com/sentry-cli/1.44.1/sentry-cli-Windows-i686.exe"
VERSION="1.44.1"
PLATFORM=`uname -s`
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'thousandsComma',
})
export class ThousandsCommaPipe implements PipeTransform {
/**
* Takes a value and makes it '1000' or 1000 to '1,000'.
*/
transform(value: any) {
import { Pipe, PipeTransform } from "@angular/core";
import startCase from "lodash/startCase";
@Pipe({
name: "startCase"
})
export class StartCasePipe implements PipeTransform {
/**
* Takes a string such as 'isCamelCase' and makes it 'Is Camel Case'.
*/
transform(value: string) {
@neilbo
neilbo / browser.ts
Created July 3, 2018 04:39
Angular Browser Provider (Ionic)
import { Injectable } from '@angular/core';
import {
InAppBrowser,
InAppBrowserOptions
} from "@ionic-native/in-app-browser";
import { Platform } from "ionic-angular";
@Injectable()
export class BrowserProvider {
@neilbo
neilbo / currency-custom.ts
Created July 14, 2017 05:01
Typescript Angular 2 Pipe for Custom Currency
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'currencyCustom'
})
export class CurrencyCustom implements PipeTransform {
/**
* @param value
*/
@neilbo
neilbo / animateWhenScrollView
Created July 14, 2017 04:58
animate element when in scroll view
var inView = false;
function isScrolledIntoView(elementID) {
// This checks if the element is in view
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elementID).offset().top;
var elementBottom = elemTop + $(elementID).height();
@neilbo
neilbo / no-fraction-currency.js
Created October 8, 2014 13:20
remove decimals in currency
app.filter('noFractionCurrency',
[ '$filter', '$locale', function(filter, locale) {
var currencyFilter = filter('currency');
var formats = locale.NUMBER_FORMATS;
return function(amount, currencySymbol) {
var value = currencyFilter(amount, currencySymbol);
var sep = value.indexOf(formats.DECIMAL_SEP);
console.log(amount, value);
if(amount >= 0) {
return value.substring(0, sep);
@neilbo
neilbo / errors-onblur.css
Created September 22, 2014 14:16
Show error on blur, and use myFormSubmitted
.form-group .help-block {
display: none;
}
.form-group.has-error .help-block {
display: block;
}