Skip to content

Instantly share code, notes, and snippets.

View Johannestegner's full-sized avatar
🐇

Johannes Johannestegner

🐇
View GitHub Profile
@Johannestegner
Johannestegner / IconGeneration.jsx
Last active August 29, 2015 14:07 — forked from twonjosh/Create iOS Icons.jsx
Photoshop script that generates Icons for Android and iOS devices.
/**
* Small script to generate icons for Android and iOS -devices.
*
* Copyrights:
* Copyright (c) 2010 Matt Di Pasquale (https://gist.github.com/mattdipasquale/711203)
* Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com (https://gist.github.com/appsbynight/3681050)
* Code cleanup, rewrite, minor buggfixing, addition of android icons and generation of the folders by Johannes Tegnér http://jite.eu
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@Johannestegner
Johannestegner / node-yolog.d.ts
Created May 13, 2015 09:20
Ambient node-yolog definition file.
declare module 'node-yolog' {
export function setObjectMaxDepth(value: number);
export function setFunctionName(state: boolean);
export function setColor(tag: string, color: string);
export function set(value: boolean, ...args: any[]);
export function get(tag: string): boolean;
export function trace(...args: any[]);
export function debug(format: string, ...args: any[]);
@Johannestegner
Johannestegner / ConsoleNotifier.js
Created June 30, 2015 18:30
Continual Notifiers
/**
* @constructor
*/
var ConsoleNotifier = function ConsoleNotifier() { };
/**
* Fetches the name of the notifier.
* @returns {string} Notifier name.
*/
ConsoleNotifier.prototype.getName = function () { return "ConsoleNotifier"; };
@Johannestegner
Johannestegner / WhatTimeIsIt.js
Created June 30, 2015 18:32
Continual Tasks
/**
* @constructor
*/
var ConsoleNotifier = function ConsoleNotifier() { };
/**
* Fetches the name of the notifier.
* @returns {string} Notifier name.
*/
ConsoleNotifier.prototype.getName = function () { return "ConsoleNotifier"; };

Keybase proof

I hereby claim:

  • I am JohannesTegner on github.
  • I am jite (https://keybase.io/jite) on keybase.
  • I have a public key whose fingerprint is 3002 1620 068A 1BB7 7935 FD0B DDAD B8FC AB6D B4D0

To claim this, I am signing this object:

@Johannestegner
Johannestegner / tc-backup.sh
Created March 25, 2017 08:28
Backup script for teamcity using basic auth via curl.
#!/usr/bin/env bash
# Change the following parameters to suit the backup you wish to create.
SERVER="https://XXXXXX" # URL to the server to back up.
WITH_TIMESTAMPS=false # If true, the file will be suffixed with current date-time.
INCLUDE_CONFIGS=true # To include configurations or not.
INCLUDE_DATABASE=true # To include database or not.
INCLUDE_BUILD_LOGS=true # To include build logs or not.
INCLUDE_PERSONAL_CHANGES=true # To include personal changes or not.
FILE_NAME_PREFIX="automatic-backup" # Name of the file (if timestamp is true, it will be suffixed with that).
@Johannestegner
Johannestegner / Scroller.js
Created October 11, 2017 18:24
JavaScript scoller start code.
export default function(targetSelector, speed) {
let current = (
(document.documentElement.scrollTop || document.body.scrollTop)
-
(window.innerHeight / 2)
);
let target = document.querySelector(targetSelector).getBoundingClientRect();
let offset = (target.bottom - (target.height / 2)) + current;
@Johannestegner
Johannestegner / scroll.js
Created February 20, 2018 10:40
Naive scroll in to view implementation
export default function(targetSelector, speed) {
let current = (
(document.documentElement.scrollTop || document.body.scrollTop)
-
(window.innerHeight / 2)
);
let target = document.querySelector(targetSelector).getBoundingClientRect();
let offset = (target.bottom - (target.height / 2)) + current;
@Johannestegner
Johannestegner / EventEmitter.js
Created February 28, 2018 11:07
Simple event emitter class to inherit from.
/**
* Event emitter class.
* Allows adding of event listeners (with on/off/once) which will be fired on emit call.
*/
export default class EventEmitter {
constructor () {
this.listeners = {};
}
/**
export default (i) => i;