Skip to content

Instantly share code, notes, and snippets.

View meyer's full-sized avatar
🍕
gimme pizza

meyer meyer

🍕
gimme pizza
View GitHub Profile
@geoff-nixon
geoff-nixon / osx-software-update-urls.txt
Created September 23, 2015 08:04 — forked from stefanschmidt/osx-software-update-urls.txt
URLs of the index files used by the software update client on OS X
10.3 (Panther):
https://swscan.apple.com/scanningpoints/scanningpointX.xml
10.4 (Tiger):
https://swscan.apple.com/content/catalogs/index.sucatalog
https://swscan.apple.com/content/catalogs/index-1.sucatalog
10.5 (Leopard):
https://swscan.apple.com/content/catalogs/others/index-leopard.merged-1.sucatalog
@paulirish
paulirish / what-forces-layout.md
Last active May 11, 2024 00:41
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent

WWDC 2014 Brain Lanier

Optionals

  • Cleaner alternative to using sentinels (NULL, NSNotFound, etc.) to represent invalid values
  • optionals are initialized to nil by default
    • var optionalNumber: Int?
  • nil is a sentinel value that works with any type
  • value is wrapped in optional by setter
    • optionalNumber = 6
@joshwand
joshwand / tumblr-likes-downloader.rb
Last active May 6, 2019 11:23
download your liked photos from tumblr
require 'tumblr_client'
require 'mechanize'
require 'date'
require 'yaml'
require 'uri'
Tumblr.configure do |config|
config.consumer_key = "consumer_key"
config.consumer_secret = "consumer_secret"
config.oauth_token = "oath_token"
@ktym
ktym / unwebarchive.rb
Created February 12, 2013 18:03
Extract contents of a .webarchive file.
#!/usr/bin/env ruby
#
# Mac OS X webarchive is a binary format of a plist file. You can extract the contents manually:
# 1. convert the plist file into XML by "plutil -convert xml1 file.webarchive"
# 2. parse the resulted XML file by some XML parser
# 3. decode "WebResourceData" by Base64.decode64(data) in each key
# 4. save the decoded content into a file indicated by "WebResourceData"
# Thankfully, the plist library can take care of annoying steps 2 and 3.
#
# Preparation:
@omarstreak
omarstreak / Install XAR
Created January 18, 2013 01:10
Bash script to install XAR. Run as root and takes one command line argument where you want the xar executable to exist.
#!/bin/bash
if [ "`whoami`" != "root" ]; then
printf "Please run this script as root or using sudo\n"
exit 0
fi
LIB_DIR=$1
CURRENT_DIR=`pwd`
printf "Setting up XAR\n"
@adamgit
adamgit / .gitignore
Last active April 8, 2024 12:58
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@joshje
joshje / supportsFFS.html
Created June 21, 2012 11:02
CSS font-feature-settings support detection
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Opentype Test</title>
<style>
span.opentype-test {
font-family: Corbel;
font-size: 100px;
position: absolute;
@kara-ryli
kara-ryli / toggle-hex-rgb.rb
Created January 12, 2012 22:47
TextMate Command to toggle hex and RGB color values
#!/usr/bin/env ruby
input = STDIN.read
match = /^\s*rgba?\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,[\d\.]+)?\s*\)(\s*;?)/.match(input)
if !match.nil? # RGB -> Hex
res = "#"
short_safe = true
matches = [match[1], match[2], match[3]].map do |m|
h = m.to_i.to_s(16)
if h.length == 1
@andrewgleave
andrewgleave / iOSMapKitFitAnnotations.m
Last active November 4, 2022 15:21
Zooms out a MKMapView to enclose all its annotations (inc. current location)
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}