Skip to content

Instantly share code, notes, and snippets.

View inorganik's full-sized avatar
🛠️
building

Jamie Perkins inorganik

🛠️
building
View GitHub Profile
@inorganik
inorganik / euroCountries.js
Created March 5, 2019 16:33
A javascript array of country codes using the Euro €
const euroCountries = [
'BE', // Belgique/België Belgium Belgique Belgien
'BG', // Bulgarija Bulgaria Bulgarie Bulgarien
'CZ', // Česko Czechia Tchéquie Tschechien
'DK', // Danmark Denmark Danemark Dänemark
'DE', // Deutschland Germany Allemagne Deutschland
'EE', // Eesti Estonia Estonie Estland
'IE', // Éire/Ireland Ireland Irlande Irland
'EL', // Elláda Greece Grèce Griechenland
'ES', // España Spain Espagne Spanien
@inorganik
inorganik / countUp-jquery.js
Last active June 28, 2023 22:03
A CountUp extension for jQuery
// Dependency: CountUp.js: https://github.com/inorganik/CountUp.js
(function ($) {
$.fn.countup = function (params) {
// make sure dependency is present
if (typeof CountUp !== 'function') {
console.error('countUp.js is a required dependency of countUp-jquery.js.');
return;
}
@inorganik
inorganik / confetti.directive.ts
Created January 29, 2019 21:25
An Angular directive around dom-confetti
import { Directive, ElementRef, OnInit, Input, HostListener } from '@angular/core';
import { confetti } from 'dom-confetti';
interface ConfettiConfig {
angle: number; // - direction of the explosion in degrees, defaults to 90.
spread: number; // - spread of the explosion in degrees, deafults to 45.
startVelocity: number; // - Initial velocity of the particles, defaults to 45.
width: number; // - width of the confetti elements
height: number; // - height of the confetti elements
elementCount: number; // - Number of particle elements, defaults to 50.
@inorganik
inorganik / TungPlayer.m
Last active December 13, 2018 13:26
Player code for Tung - a social podcast player for iOS
/* These are methods extracted from a singleton class i used called
"TungCommonObjects". I didn't include the properties just
the methods concerned with playing and caching audio.
This file acted as NSURLConnectionDataDelegate, AVAssetResourceLoaderDelegate.
It is broken into the following parts, separated by pragma marks.
- Player Instance methods
- caching/saving episodes
- NSURLConnection delegate
@inorganik
inorganik / cloudSettings
Created October 15, 2018 22:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-10-15T22:15:03.430Z","extensionVersion":"v3.1.2"}
@inorganik
inorganik / bash_profile.sh
Created August 22, 2018 19:25
nvmrc hook for bash profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then
return
fi
PREV_PWD=$PWD
@inorganik
inorganik / email-subscribe-form.component.ts
Last active May 19, 2022 07:19
MailChimp subscribe form with Angular 5 using jsonp
import { Component } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { HttpClient, HttpParams } from '@angular/common/http';
interface MailChimpResponse {
result: string;
msg: string;
}
@Component({
@inorganik
inorganik / Markdown_colors.md
Last active January 8, 2018 17:34
How can you hack markdown into displaying colors?
+ this will be highlighted in green
- this will be highlighted in red

Inline colors? diff - red Probably doesn't work

@inorganik
inorganik / ImageCacher.swift
Created September 4, 2017 17:25
returns image data by fetching locally or remote, caching the result so subsequent fetches are local
func getImageDataWithUrlString(imageUrlString: String) -> NSData? {
let url = URL(string: imageUrlString)
if let filename: String = url?.lastPathComponent {
let imagesDirUrl = try! FileManager.default.url(for: .cachesDirectory, in: .localDomainMask, appropriateFor: nil, create: true)
let fileUrl = imagesDirUrl.appendingPathComponent(filename)
do {
// get a cached copy
let _ = try fileUrl.checkResourceIsReachable()
let imageData = NSData(contentsOf: fileUrl)
@inorganik
inorganik / thunderclap.js
Last active March 31, 2021 08:50
Smash Medium's clap button the max number of times (50) in 1 second
// smash Medium's clap button the max number of times
function simulateClick(node) {
var md = document.createEvent('MouseEvents');
md.initEvent('mousedown', true, false);
node.dispatchEvent(md);
var mu = document.createEvent('MouseEvents');
mu.initEvent('mouseup', true, false);
node.dispatchEvent(mu);
}