Skip to content

Instantly share code, notes, and snippets.

View fatso83's full-sized avatar
🐢
Two toddlers. Very little time for OSS after work hours. File a PR!

Carl-Erik Kopseng fatso83

🐢
Two toddlers. Very little time for OSS after work hours. File a PR!
View GitHub Profile
@fatso83
fatso83 / README.md
Last active September 13, 2016 12:56
Keep an organization team in sync with all of the members. Replace the team id in the script if needed.

Add members

This script is all you need to keep the all-in-makingwaves group include all of the makingwaves org's members. Useful when everyone should have access to a repo.

node add-users.js my.user

That's all. You can optionally pre-set the password as an environment variable to avoid typing it in when prompted:

@fatso83
fatso83 / srcset-debug-util.js
Last active October 30, 2023 10:53
SrcSet debug utility to print info on the currently loaded image
/**
* Use this to help determine which images are being used
* at which breakpoint. Will print lots of useful information
* on shown resolution, actual resolution, DPR and more
* Usage:
* var elems = document.querySelectorAll('.c-hero-banner__background img')
* responsiveImageDebugOutput(elems);
*
* Author: Carl-Erik Kopseng
* Source: https://gist.github.com/fatso83/55fc446df3f3965ecd66e8307a5dc0e6
@fatso83
fatso83 / octopus-description.sh
Last active January 21, 2017 10:43
Skript for å generere en deploybeskrivelse i Octopus med Markdown-formatering
#!/bin/bash
# Skript for å generere en deploybeskrivelse i Octopus med HTML-formatering
if (( $# < 2 )); then
echo "Oppgi commitid-en tilsvarende siste deploy som første argument"
echo "Oppgi kjedenavn (ultra, meny, joker) som andre argument"
echo -e "Eksempel:\n\toctopus-description.sh 8f7c4f6 meny"
exit 1
fi
github_base="https:\/\/github.com\/MWNG\/multikanal.epi7.$2"
@fatso83
fatso83 / slot-machine.html
Last active January 16, 2017 11:30
A spinning slot machine effect, with an overlay at the end that might correspond to the result.
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
<style>
*{
box-sizing: border-box;
}
body {
overflow: hidden;
}
@fatso83
fatso83 / observable.js
Created February 1, 2017 12:47
Observable impl - ripped from riot.js 1.0.4. No dependencies.
var observable = function(el) {
var callbacks = {}, slice = [].slice;
el.on = function(events, fn) {
if (typeof fn === "function") {
events.replace(/[^\s]+/g, function(name, pos) {
(callbacks[name] = callbacks[name] || []).push(fn);
fn.typed = pos > 0;
});
}
@fatso83
fatso83 / spinner.svg
Created February 8, 2017 09:09
Animated Spinner SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// globals: window, document, $
//
// Feature detect the actual transitionFinished event
// used by the current browser
//
// Used like this:
// var features = {};
// transitionEndFeatureDetection((eventName) => {
// features.transitionFinishedEvent = eventName;
// });
@fatso83
fatso83 / fhnumber.js
Last active June 12, 2017 14:53
Generates Norwegian FH numbers (Felles Hjelpenummer) - 11 digit ids used at hospitals for tourists and people without ids
// original: https://gist.github.com/a849ca8a75eb4b5e35cd1af700435875
// The two checksum series.
// for digit 10, the first check digit
const checksumSeries1 = [3, 7, 6, 1, 8, 9, 4, 5, 2, 1]; // 10 digits
// for digit 11, the 2nd check digit
const checksumSeries2 = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1]; // 11 digits
function sumDigits(number, checksumSeries) {
// Split into array of digits
{
"presets": [
"es2015"
],
"plugins": [
"transform-class-properties",
"transform-react-jsx",
"transform-object-rest-spread",
"babel-root-slash-import"
]
@fatso83
fatso83 / index.js
Last active June 22, 2017 09:37
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const sinon = require('sinon');
const assert = require('assert');
const myModule = {
method10() {
return 10;