Skip to content

Instantly share code, notes, and snippets.

@daniellevass
daniellevass / android_material_design_colours.xml
Last active September 9, 2024 06:08
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@daniellevass
daniellevass / sharing_data_ios.md
Last active September 21, 2022 23:06
Sharing Data between iPhone and Apple Watch apps

#Sharing Data between iPhone and Apple Watch apps

So we've already taken a look at some of the issues we've faced building our Whiskr Apple Watch app, next we're going to look into how we shared data between the iPhone and Apple Watch app. This was probably one of the hardest aspects to learn and get right, and the current documentation isn't all that great!

To do this we'll have to create an App Group which is essentially a space which both apps can use. It was brought in with the exetension framework in iOS8 so apps can communicate with their Today widgets, or custom keyboards, and amongst other applications.

Add Capabilities

The first thing we have to do is add the app group capability to both our iPhone and Watch Watch Extension targets.

@daniellevass
daniellevass / gradle_build_time_tool.js
Last active February 28, 2022 20:36
gradle build time tool
const fs = require('fs')
// update this to match your computer
let directory="//Users/daniellevass/.gradle/daemon/"
fs.writeFile('output.csv', '', function(){})
var outputFile = fs.createWriteStream('output.csv')
function readVersionFolders(directory) {
fs.readdirSync(`${directory}/`).forEach(file => {
@daniellevass
daniellevass / starting_library_project_AS.md
Last active August 30, 2020 00:48
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

@daniellevass
daniellevass / one.kotlin
Created February 3, 2020 19:28
spek medium post
describe("end to end flow of typical user") {
CurrentAccountImplementation.connect()
it("balance starts at 0") {
assertThat(CurrentAccountImplementation.getCurrentBalance()).isEqualTo(0)
}
it("balance is 10 when I add 10") {
CurrentAccountImplementation.addMoney(10)
assertThat(CurrentAccountImplementation.getCurrentBalance()).isEqualTo(10)
@daniellevass
daniellevass / cookie_clicker.md
Last active January 28, 2020 12:48
cookie clicker
@daniellevass
daniellevass / christmas.js
Created December 25, 2015 00:47
my script to collect data from google's santa tracker
var request = require('request');
var dateFormat = require('dateformat');
var fs = require('fs');
var colors = require('colors');
var destinations;//our final list of destinations
//function to get data from google - set on a timeout at the bottom to refresh it
function getData(){
@daniellevass
daniellevass / watchkit_multiple_row_types.md
Last active November 25, 2018 02:57
How to Add Multiple Row Types in an Apple Watch Table

#How to Add Multiple Row Types in an Apple Watch Table

Since we've got our project set up one of the first interface items you might be using is a table. There are a lot of blog posts on how to get started with tables however one of the things we wanted to do with Whiskr was to use multiple types of rows in a single table e.g. we have a loading row, a heading row, and a content row. This blog will help you use several types of rows in your app too!

Imgur

a heading, and content row as displayed in our Whiskr app

##1. Interface Builder

Firstly, we want to open the Apple App Storyboard (found in the WatchKit App folder). You should have an interface controller with a table in it. To create different types of rows you need to add more rows by selecting the table and in the inspector increase the number of rows. This will g

@daniellevass
daniellevass / idiots-guide-to-littlebits-cloudbit-api.md
Last active May 22, 2018 19:48
Idiots Guide to Using littleBits cloudBit API

#Idiots Guide to Using littleBits cloudBit API

##Introduction

  1. Connect a cloudBit to your network using the instructions at http://control.littlebitscloud.cc/
  2. Find out your AccessToken
  • visit http://control.littlebitscloud.cc/
  • on the left hand side select any of your cloudBits
  • using the tab bar at the bottom select settings
  • scroll down and copy your AccessToken