A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
import UIKit | |
import Security | |
class Keychain { | |
class func save(key: String, data: NSData) -> Bool { | |
let query = [ | |
kSecClass as String : kSecClassGenericPassword as String, | |
kSecAttrAccount as String : key, | |
kSecValueData as String : data ] |
class MyCell: UITableViewCell { | |
override init(style: UITableViewCellStyle, reuseIdentifier: String?) { | |
super.init(style: style, reuseIdentifier: reuseIdentifier) | |
configureView() | |
} | |
required init(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
configureView() |
remove mod4 = Super_L | |
add control = Super_L | |
remove control = Control_L | |
add mod4 = Control_L |
// Remember to @import WebKit at the top of the class | |
// Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head> | |
NSString *source = @"var meta = document.createElement('meta'); \ | |
meta.name = 'viewport'; \ | |
meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; \ | |
var head = document.getElementsByTagName('head')[0];\ | |
head.appendChild(meta);"; | |
WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; |
Note: This is an older post that I did back when I thought I might have time to be a blogger. Oh I was oh so wrong. However, it has proven useful for some folks on stackoverflow. Thus I'm keeping it alive here on Gist.
One of my past projects dealt heavily with an open source Apple technology called HTTP Live Streaming. It’s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about any server with nothing but a few free software tools provided by Apple**. However, it has a few additional features that I think make it a really exciting tool. Yet, I haven’t seen HTTP Live Streaming used very much. This is probably mainly due to the combination of a lack of good/clear documentation, and Apple’s Live Streaming Developer Tools being command line based also make the barrier to entry higher than many developers want to deal with.
The hope is to share my understanding of how to use this technology to:
// | |
// MediaItem.swift | |
// | |
// Created by CS193p Instructor. | |
// Copyright (c) 2015 Stanford University. All rights reserved. | |
// | |
import Foundation |
/** | |
* @author Juliano Castilho <[email protected]> | |
*/ | |
var React = require('react'); | |
var AffixWrapper = React.createClass({ | |
/** | |
* @type {Object} | |
*/ | |
propTypes: { |
// iOS 8 example | |
- (void)speechText:(NSString *)text | |
{ | |
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init]; | |
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text]; | |
utterance.rate = AVSpeechUtteranceMinimumSpeechRate; | |
utterance.volume = 1; | |
// initialize voice with language code | |
AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:[AVSpeechSynthesisVoice currentLanguageCode]]; | |
utterance.voice = voice; |
#!/bin/bash | |
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ] | |
resolution=${1:-SD} | |
year=${2:-2015} | |
shift | |
shift | |
ids=$* | |
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]') |