Skip to content

Instantly share code, notes, and snippets.

View scruffyfox's full-sized avatar
🏳️‍🌈
+++

ScruffyFox scruffyfox

🏳️‍🌈
+++
  • UK
View GitHub Profile
@scruffyfox
scruffyfox / api.json
Last active August 29, 2015 14:15
api.json
{
"stories": [
{
"title": "Secretly-filmed MPs deny wrongdoing",
"description": "Ex-Foreign Secretaries Jack Straw and Sir Malcolm Rifkind say they have broken no rules after being secretly filmed apparently offering their services to a private company for thousands of pounds.",
"link": "http://www.bbc.co.uk/news/uk-politics-31580374#sa-ns_mchannel=rss&ns_source=PublicRSS20-sa",
"published": 1424686943,
"thumbnail": "http://news.bbcimg.co.uk/media/images/81176000/jpg/_81176097_rifkind-straw.jpg"
},
{
@scruffyfox
scruffyfox / hook.rb
Last active December 17, 2015 22:21
Calculator to calculate the hit/miss rate of something in twitch IRC
#
# By Callum Taylor
# Usage:
# !reset -> resets the counts back to 0/0
# !hit [num] -> adds [num] to the current success rate, and increases the attempt count by [num] (num is optional, defaults to 1)
# !miss [num] -> adds [num] to the current attempts (num is optional, defaults to 1)
# !results -> displays current results
# !rateset [success] [total] -> sets the current values of success/total rates
# !rateadd [username] -> adds a user to the allowed user list to execute commands
# !rateremove [username] -> removes a user from the allowed user list to execute commands
@scruffyfox
scruffyfox / styles.xml
Created January 21, 2015 11:08
Cool styles
<style name="SectionTitle">
<item name="android:textColor">@color/section_title</item>
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:singleLine">true</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<!--<item name="android:paddingTop">16dp</item>-->
<!--<item name="android:paddingBottom">20dp</item>-->
@scruffyfox
scruffyfox / gist:7d878993cbdd5afb711e
Created November 26, 2014 15:50
Fucking inset linear layout divider
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item android:top="8dp" android:bottom="8dp" android:left="16dp">
<shape
android:shape="rectangle"
>
<size
require 'json'
require 'rest'
require 'date'
@notification_token = ""
@pushes = [
''
]
# POST request -> logging in
@scruffyfox
scruffyfox / build.gradle
Last active August 29, 2015 14:08
Delombok javadoc generator with dependency inclusion
def srcJava = 'src/main/java'
def srcDelomboked = 'build/src-delomboked/main/java'
task delombok {
inputs.files file(srcJava)
outputs.dir file(srcDelomboked)
doLast {
FileCollection collection = files(configurations.compile)
FileCollection sumTree = collection + fileTree(dir: 'bin')
Intent firstAidIntent;
PackageManager manager = getPackageManager();
try
{
firstAidIntent = manager.getLaunchIntentForPackage("com.cube.arc.fa");
if (firstAidIntent == null)
{
throw new PackageManager.NameNotFoundException();
}

Keybase proof

I hereby claim:

  • I am scruffyfox on github.
  • I am scruffyfox (https://keybase.io/scruffyfox) on keybase.
  • I have a public key whose fingerprint is DA13 A9C9 5219 DE6A 79F5 4443 60E6 C1E5 939A 8BAD

To claim this, I am signing this object:

@scruffyfox
scruffyfox / Example.md
Created July 15, 2014 10:15
Android XML pre-processor
xmlns:android="http://schemas.android.com/apk/res/android"

%ScrollView
{
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  
  %LinearLayout 
 {
/*
* Copyright (C) 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software