Skip to content

Instantly share code, notes, and snippets.

View android_material_design_colours.xml
<?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 Sep 21, 2022
Sharing Data between iPhone and Apple Watch apps
View sharing_data_ios.md

#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.

View gradle_build_time_tool.js
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 Aug 30, 2020
Getting Started with a library project in Android Studio
View starting_library_project_AS.md

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

View one.kotlin
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)
View cookie_clicker.md
@daniellevass
daniellevass / christmas.js
Created Dec 25, 2015
my script to collect data from google's santa tracker
View christmas.js
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 Nov 25, 2018
How to Add Multiple Row Types in an Apple Watch Table
View watchkit_multiple_row_types.md

#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
Idiots Guide to Using littleBits cloudBit API
View idiots-guide-to-littlebits-cloudbit-api.md

#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