Skip to content

Instantly share code, notes, and snippets.

View tskulbru's full-sized avatar

Torstein S. Skulbru tskulbru

View GitHub Profile
@tskulbru
tskulbru / ColorUtils.java
Created March 11, 2015 11:37
Utility class for average and dominant color in a bitmap for Android
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@tskulbru
tskulbru / gh-add-repos-to-team.sh
Created May 16, 2024 12:25 — forked from narze/gh-add-repos-to-team.sh
Add repos to team with gh
#!/bin/bash
PERMISSION="push" # Can be one of: pull, push, admin, maintain, triage
ORG="orgname"
TEAM_SLUG="your-team-slug"
# Get names with `gh repo list orgname`
REPOS=(
"orgname/reponame"
)
{
"matrix": [
{
"code": "0x00",
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"layers": {
"0": {

Keybase proof

I hereby claim:

  • I am tskulbru on github.
  • I am tskulbru (https://keybase.io/tskulbru) on keybase.
  • I have a public key ASCCyhpmWAKACNH_zFsvRSSk67QmLzPqASilqH19eZNnwwo

To claim this, I am signing this object:

Verifying that "tskulbru.id" is my Blockstack ID. https://onename.com/tskulbru

Keybase proof

I hereby claim:

  • I am tskulbru on github.
  • I am tskulbru (https://keybase.io/tskulbru) on keybase.
  • I have a public key ASA2AcZHeooAS3zdbjW2361GOm6C4bbaAhYHCSG5DYs1hAo

To claim this, I am signing this object:

@tskulbru
tskulbru / replaceNSlocalized.sh
Created December 22, 2016 13:24
Converts NBLocalization to Swiftgens tr(.). Based on https://gist.github.com/Lutzifer/3e7d967f73e38b57d4355f23274f303d but changed regex to suit my own need.
#/bin/sh
# Run this inside the project to replace NSLocalizedString calls with swiftgen calls in all .swift files.
# Do not forget to make a backup before.
find . -type f | grep ".swift" > swiftindex.temp
while IFS= read -r filename
do
echo $filename
@tskulbru
tskulbru / EnvConfig.swift
Last active August 30, 2016 13:22 — forked from drunknbass/EnvConfig.swift
Firebase stage + Prod config
import Foundation
@objc(EnvConfig)
class EnvConfig: NSObject {
#if ENVConfigStaging
class var isProduction:Bool {
return false
}
var O = {
Foo: function() {
return "Foo for life yo!";
}
};
var M = "Foo";
console.log(O[M]());
namespace.views.MyWizard = Backbone.Views.extend({
initialize: function() {
_.bindAll(this, 'render', 'wizardMethod');
}
render: function() {
this.wizardMethod();
return this;
},