Skip to content

Instantly share code, notes, and snippets.

@matthewmayer
matthewmayer / gist:11206450
Last active August 29, 2015 14:00
Check properties in obj-c
#!/usr/bin/python
import fnmatch
import os
import re
path = "."
files = [os.path.join(dirpath, f)
for dirpath, dirnames, files in os.walk(path)
for f in fnmatch.filter(files, '*.h')+fnmatch.filter(files, '*.m')]
@matthewmayer
matthewmayer / gist:69f5feb1638d03b21461
Created July 25, 2014 06:42
Delete messages in the "future" which mess up the order of mesages in Skype
#/Users/matt/Library/Application Support/Skype/USERNAME/main.db
DELETE FROM Messages WHERE timestamp>strftime('%s', 'now')
http://adndevblog.typepad.com/cloud_and_mobile/2012/06/android.html
* Start Parallels Desktop with the Android 4 image
* Run terminal emulator -> netcfg
* Check the eth0 IP (e.g. 192.168.1.167)
On Mac
````
cd /Applications/android/sdk/platform-tools
./adb connect 192.168.1.167
@matthewmayer
matthewmayer / gist:4214946
Created December 5, 2012 11:47
Loop through PNG files in a folder, creating non-retina versions from @2x retina versions if it does not already exist.
#!/bin/bash
for i in *@2x.png
do
if [ ! -f ${i/@2x.png/}.png ]
then
convert $i -resize 50% ${i/@2x.png/}.png
fi
done
@matthewmayer
matthewmayer / gist:4442272
Last active December 10, 2015 13:38 — forked from anonymous/gist:4442268
Export list of UDIDs and device names from https://developer.apple.com/ios/manage/devices/index.action
var tds = document.getElementsByTagName("td"); for (var i=0;i<tds.length;i++) {var td = tds[i]; if (td.attributes["title"]) {var name = td.parentNode.getElementsByClassName("name")[0].getElementsByTagName("span")[0].firstChild.nodeValue; console.log(td.attributes["title"].nodeValue+","+name);}}
@matthewmayer
matthewmayer / gist:5508346
Last active December 16, 2015 22:39
objective-c shortcuts
//ok
[an_array objectAtIndex:i]
//better
an_array[i]
//ok
[dict objectForKey:@"foo"]
//better
dict[@"foo"]
@matthewmayer
matthewmayer / checkGitRepos.py
Last active December 18, 2015 02:29
Check if all your git repos are synced with a server
#!/usr/bin/python
import glob
import os
import subprocess
folders = glob.glob("*")
for f in folders:
if os.path.isdir(f):
config = f+"/.git/config"
if not os.path.exists(config):
print "%s appears not to be a Git repo" % f
import requests
import json
import calendar
from datetime import datetime, timedelta
#lists all files above 10MB in your slack files repo
#based on https://www.shiftedup.com/2014/11/13/how-to-bulk-remove-files-from-slack
_token = ""
_domain = ""
@matthewmayer
matthewmayer / gist:2651829
Last active August 22, 2017 06:47
Create all sizes of icon for a Universal iOS app - requires imagemagick
#iphone only
convert -resize 58x58 1024.png 58.png
convert -resize 87x87 1024.png 87.png
convert -resize 80x80 1024.png 80.png
convert -resize 120x120 1024.png 120.png
convert -resize 180x180 1024.png 180.png
convert -resize 40x40 1024.png 40.png
convert -resize 60x60 1024.png 60.png
[
{
"code": "ad",
"description": "",
"name": "Andorra",
"callingCodes": [
"+376"
],
"currencies": [
"Euro"