Skip to content

Instantly share code, notes, and snippets.

View boska's full-sized avatar
🎯
Focusing

Yang Lee boska

🎯
Focusing
View GitHub Profile
extension URL {
func fetch(completionHandler: ((Data) -> ())? = nil) {
print("Request: \(self)")
URLSession.shared.dataTask(with: self) {
guard
let response = $1 as? HTTPURLResponse, response.statusCode == 200,
let data = $0, $2 == nil
else { return }
completionHandler?(data)
}.resume()
@boska
boska / ios-interview.md
Created May 18, 2017 06:21
ios-interview.md

1.

Consider the following code

var array1 = [1, 2, 3, 4, 5]
var array2 = array1
array2.append(6)
var len = array1.count
<vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">
<vmap:AdBreak breakId="preroll" breakType="linear" timeOffset="00:00:00.000">
<vmap:Extensions>
<vmap:Extension type="instream">
<position type="bottom">0</position>
<align type="bottom">0</align>
</vmap:Extension>
</vmap:Extensions>
<vmap:AdSource allowMultipleAds="false" followRedirects="true" id="preroll-ad-1">
<vmap:AdTagURI templateType="vast3">

1.

Consider the following code

var array1 = [1, 2, 3, 4, 5]
var array2 = array1
array2.append(6)
var len = array1.count
@boska
boska / ios_sample.md
Last active May 8, 2017 03:48
iOS example

iOS ConSense API SAMPLE

Prerequisites

  • ConSense Account
  • Xcode
  • Google IMA SDK 3.5.1+

Code Snippet

# iOS ConSense API SAMPLE
## Prerequisites
+ ConSense Account
+ Xcode
## Code Snippet
```swift
let videoURL = "your encoded video url"
/
// 412.swift
// leetcode
//
// Created by boska on 18/04/2017.
// Copyright © 2017 boska. All rights reserved.
//
import XCTest
func fizzBuzz(_ n: Int) -> [String] {
var result: [String] = []
//
// MaxiumFourDigits.swift
// Find the maximum valid time that can be displayed on a digital
// clock using four given digits.
// leetcode
//
// Created by boska on 10/02/2017.
// Copyright © 2017 boska. All rights reserved.
//
import Foundation
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component, PropTypes } from 'react';
import { Animated, Image, Button, Alert, AppRegistry, StyleSheet, Text, View } from 'react-native';
const getRandomInt = (min, max) => {
@boska
boska / DHT11
Created February 26, 2017 10:51
// DHT Temperature & Humidity Sensor
// Unified Sensor Library Example
// Written by Tony DiCola for Adafruit Industries
// Released under an MIT license.
// Depends on the following Arduino libraries:
// - Adafruit Unified Sensor Library: https://github.com/adafruit/Adafruit_Sensor
// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
#include <Adafruit_Sensor.h>