Skip to content

Instantly share code, notes, and snippets.

View MainasuK's full-sized avatar

CMK MainasuK

View GitHub Profile
@s-aska
s-aska / Keychain.swift
Last active September 16, 2022 03:37
Swift Keychain class ( supported Xcode 6.0.1 )
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 ]
@addyosmani
addyosmani / README.md
Last active May 10, 2025 11:24 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

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

@natecook1000
natecook1000 / MyCell.swift
Created November 19, 2014 15:57
Simple UITableViewCell subclass
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
@paulofierro
paulofierro / wkwebview_disable_magnification.m
Last active March 13, 2020 16:11
Disable magnification in WKWebView
// 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];
@chrislavender
chrislavender / gist:cad26500c9655627544f
Last active March 29, 2025 22:12
HTTP Live Streaming Tutorial

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:

@mattpetters
mattpetters / MediaItem.Swift
Last active January 30, 2017 21:42
Corrected Twitter Package - CS193p Lecture 10 - Updated for XCode 6.3
//
// MediaItem.swift
// Twitter
//
// Created by CS193p Instructor.
// Copyright (c) 2015 Stanford University. All rights reserved.
//
import Foundation
@julianocomg
julianocomg / AffixWrapper.jsx
Last active May 17, 2024 04:24
A simple affix React component.
/**
* @author Juliano Castilho <[email protected]>
*/
var React = require('react');
var AffixWrapper = React.createClass({
/**
* @type {Object}
*/
propTypes: {
@Koze
Koze / TextSpeechExample8.m
Last active July 22, 2016 22:40
Text Speech Example in iOS 8
// 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;
@idiomatic
idiomatic / wwdc.sh
Last active April 10, 2022 03:52
Fetch WWDC videos, slides, and sample code.
#!/bin/bash
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
resolution=${1:-SD}
year=${2:-2015}
shift
shift
ids=$*
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')