Skip to content

Instantly share code, notes, and snippets.

View pocmo's full-sized avatar
🚀
Just passing by.

Sebastian Kaspari pocmo

🚀
Just passing by.
View GitHub Profile
@pocmo
pocmo / gist:c30d2a0ef5967bf4116c
Created March 14, 2015 23:06
Mozilla Robocop Alias
# Alias for building and running robocop tests:
# robocop <test>
function robocop_test {
./mach build build/mobile/robocop
./mach robocop $1
}
alias robocop=robocop_test
#!/usr/bin/ruby
# Brainfuck Interpreter
# (C) Sebastian Kaspari 2009
# Usage: bf2 [FILE]
require 'rubygems'
require "highline/system_extensions"
include HighLine::SystemExtensions
code = ARGF.read # code
#!/usr/bin/ruby1.9.1
# Brainfuck Interpreter
# (C) Sebastian Kaspari 2009
# Usage: bf4 [FILE]
# This code is much much faster than the last one, which did
# a lot of unnecessary loops which could also lead to bugs
#
# There's now a bracket map which stores starting and ending
# brackets for direct "jumps", that should speed up things too
@pocmo
pocmo / netbeans_php_colors.xml
Created April 18, 2011 14:10
Netbeans like PHP colors for IntelliJ IDEA 10
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="netbeans_php_colors" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="EDITOR_FONT_NAME" value="Monospaced" />
<colors />
<attributes>
<option name="CUSTOM_LINE_COMMENT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="808080" />
@pocmo
pocmo / PermissionsExample.java
Last active April 14, 2016 12:33
Firefox for Android - Permissions Example
Permissions
.from(context)
.withPermissions(Manifest.permission.ACCESS_FINE_LOCATION)
.onUIThread()
.andFallback(() -> doSomethingIfPermissionsHasNotBeenGranted())
.run(() -> doSomethingWithPermission());
// Granting a single permission to an app
adb shell pm grant <package> android.permission.<permission>
// Install the APK with all runtime permissions granted automatically:
adb install -g <apk>
@pocmo
pocmo / DeckView Demo (Deckster.java)
Created January 8, 2010 18:32
Demo of "DeckView" for Android, see Video at: http://www.youtube.com/watch?v=sv74m0Mcmms
package org.yaaic.deckster;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Gallery;
##############################################################
# Build Firefox for Android ##################################
##############################################################
ac_add_options --enable-application=mobile/android
mk_add_options MOZ_OBJDIR=./objdir-frontend
# Artifact builds (Fox yeah!)
ac_add_options --enable-artifact-builds
@pocmo
pocmo / permissions-lollipop.txt
Last active December 8, 2016 14:28
Android Lollipop - Permissions + Groups + Protection Level
(android.permission-group.MESSAGES) android.permission.SEND_SMS dangerous
(android.permission-group.MESSAGES) android.permission.SEND_RESPOND_VIA_MESSAGE <unknown>
(android.permission-group.MESSAGES) android.permission.RECEIVE_SMS dangerous
(android.permission-group.MESSAGES) android.permission.RECEIVE_MMS dangerous
(android.permission-group.MESSAGES) android.permission.CARRIER_FILTER_SMS <unknown>
(android.permission-group.MESSAGES) android.permission.RECEIVE_EMERGENCY_BROADCAST <unknown>
(android.permission-group.MESSAGES) android.permission.READ_CELL_BROADCASTS dangerous
(android.permission-group.MESSAGES) android.permission.READ_SMS dangerous
@pocmo
pocmo / count.js
Last active April 25, 2017 09:54
Count open/closed/total tasks for list of visible GitHub issues
(function() {
let open = total = done = 0;
let collection = document.getElementsByClassName('task-progress-counts');
for (let i = 0; i < collection.length; i++) {
let counts = collection[i].innerHTML.split(" of ").map((x) => parseInt(x));
total += counts[1]; done += counts[0]; open += counts[1] - counts[0];
}
alert("Total: " + total + "\nOpen: " + open + "\nDone: " + done);
})();