Skip to content

Instantly share code, notes, and snippets.

var additionalFakeForecasts = {
'2357536' : {
key: '2357536',
label: 'Austin, TX',
created: '2016-07-22T01:00:00Z',
channel: {
astronomy: {
sunrise: "5:43 am",
sunset: "8:21 pm"
},
@davidair
davidair / AsyncActivity.kt
Created November 9, 2018 23:12
A base class activity that leverages Kotlin coroutines and allows streamlining activity invocation
/**
* Copyright 2017 Google LLC.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#include <iostream>
#include <sstream>
void IterativeNestedLoop(int depth, int max, std::function<void(int* slots, int)> action)
{
// Initialize the slots to hold the current iteration value for each depth
int* slots = (int*)alloca(sizeof(int) * depth);
for (int i = 0; i < depth; i++)
{
slots[i] = 0;
@davidair
davidair / wikipedia_to_fen.py
Last active December 8, 2017 20:24
Convert Wikipedia Chess Diagram to FEN
#!/usr/bin/python
# Copyright 2017 Google LLC.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
@davidair
davidair / EasyString.swift
Created October 12, 2017 14:54
Example of an easier string in Swift (not optimized)
/*
Copyright 2017 Google Inc.
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software