Skip to content

Instantly share code, notes, and snippets.

@philipbjorge
philipbjorge / README.md
Created January 26, 2019 05:47
SCRIPT-8
@philipbjorge
philipbjorge / MainActivity.2.kt
Created August 20, 2018 08:14
Android Tutorial Snippets
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.mainmenu, menu)
whatsNewToolbarButton = menu!!.findItem(R.id.whatsNewToolbarButton)
setWhatsNewBadge(appnouncementsClient?.unseenReleaseNotesCount ?: 0)
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item?.itemId == R.id.whatsNewToolbarButton) {
if (appnouncementsClient != null) {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@philipbjorge
philipbjorge / pipeline.css
Created February 21, 2016 19:33
Pipeline Styles
.task-rebuild:not([id*='Deploy']) {
display: none;
}
@philipbjorge
philipbjorge / philipbjorge-fastmail-unsubscribe.js
Created November 7, 2015 00:46
Fastmail Unsubscribe Button GreaseMonkey
// ==UserScript==
// @name Fastmail Unsubscribe
// @namespace philipbjorge-fastmail-unsubscribe
// @include https://*.fastmail.com/*
// @include https://fastmail.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 1
// @grant GM_addStyle
// ==/UserScript==
@philipbjorge
philipbjorge / SearchBar.java
Created March 28, 2013 13:32
Android Asynchronous ContentProvider - Search as you type
package edu.wwu.cs412.tvfanatic;
import edu.wwu.cs412.tvfanatic.account.AccountPreferenceActivity;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.app.SearchManager;
import android.app.FragmentManager.BackStackEntry;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@philipbjorge
philipbjorge / Grammar__Grammar.py
Last active December 15, 2015 00:38
Empty Set Literal Notation for Python 2.7 [BUGFIX] Replaced minus sign with @ symbol. With the minus sign, Python couldn't handle any set notation that started with a negative (e.g. {-3} would fail).
# Grammar for Python
# Note: Changing the grammar specified in this file will most likely
# require corresponding changes in the parser module
# (../Modules/parsermodule.c). If you can't make the changes to
# that module yourself, please co-ordinate the required changes
# with someone who can; ask around on python-dev for help. Fred
# Drake <fdrake@acm.org> will probably be listening there.
# NOTE WELL: You should also follow all the steps listed in PEP 306,
@philipbjorge
philipbjorge / EmptySetLiteral.py
Last active March 2, 2016 12:10
Empty Set Literal Notation for Python - {_}
"""
Python's set data structure is the only one without a literal
notation for an empty set.
http://excess.org/article/2012/11/python-container-literals/
This is an ast transformer to add an empty set notation with the
following form:
empty_set = {_}
@philipbjorge
philipbjorge / clj.test.js
Created March 6, 2013 03:23
Tiny testcase for clj.js
var parse = Clojure.parse;
console.log(parse("nil", {}));
console.log(parse("true", {}));
console.log(parse("hello world", {}));
console.log(parse("\C", {}));
console.log(parse('{:first "Fred" :last "Mertz"}', {}));
console.log(parse('(1 2 3 4)', {}));
console.log(parse('[1 2 "three" 4]', {}));
console.log(parse('#{1 2 3 1 2 3}', {}));
@philipbjorge
philipbjorge / rayage
Created March 5, 2013 20:42
Rayage Implementation Details
Front End:
Run tests functionality (we can run every time they hit run)
Test output tab has a line for every line in the reference
Modify the html in static/custom/templates/Rayage.html to mess with test output contents
Run sends a message to server 'run_project_request'. We can hook off of that message handler to run the tests as well
Submit assignment
message to server: "submit_assigment"
Display feedback from professor/grader and state of files at submit-time
Codemirror: get the codemirror (editor) instance associated with the filename. codemirrorinstance.add_line_widget(comment)
See example with build errors.