Skip to content

Instantly share code, notes, and snippets.

@yanks
yanks / gist:b9d512c032c9d2a8c515
Last active August 29, 2015 14:18
WatchKit + xcodebuild + CI

If you have a Jenkins/CI build machine like we do or just use xcodebuild/xcbuild, you might notice some CodeSign issues with your builds that look something like this:

[ERROR]Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “<my team id>” were found.

You've confirmed you have all the signing set up correctly in your extension, so what gives? Well, it turns out that XCode validates dependencies for all targets including your WatchApp target. You'll notice that the project settings give you a super barebones space for defining your target information (bundle id, team identifier, etc).

What it doesn't let you do is define various scheme level things like the plist to use, and maybe a different signing identity! Here's the solution:

@yanks
yanks / cleandesktop
Last active August 29, 2015 14:13
Move day-old files off your desktop
#!/usr/bin/env ruby
now = Time.now
desktop = File.expand_path("~/Desktop")
Dir.entries(desktop).each() do |file|
if file.start_with?(".") || file.start_with?('Graveyard') then
next
end
ftime = File.atime("#{desktop}/#{file}")
if (now.to_i - ftime.to_i > (60*60*24)) then
@yanks
yanks / find_sim.rb
Created September 11, 2014 19:56
Find sim/app dir on disk, open in Finder.
#!/usr/bin/env ruby
# This script will open the directory with the simulator/app that you specify.
# Usage: 'find_sim plus swa' results finding the iPhone 6 Plus applications directory
# and Swarm.app (for me!)
# If you want just the plus sim: 'find_sim plus'
# Why? Because the dir hierarchy is crazy. This is what it looks like:
# /Users/jeffforbes/Library/Developer/CoreSimulator/Devices/<device guid>/data/Containers/Bundle/Application/<app dir guid>/yourapp.app
@yanks
yanks / gist:2856019
Created June 2, 2012 01:04
Wundermap Fix Userscript
// ==UserScript==
// @name Wundermap fix
// @namespace http://www.elrepositorio.com/
// @description Removes crappy wundermap stuff
// @include http://wunderground.com/wundermap/
// @include http://www.wunderground.com/wundermap/
// ==/UserScript==
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);ret
def is_palindrome?(test)
str = test.to_s
split = str.length/2
front = str[0..split-1]
back = str[str.length-split, str.length]
front == back.reverse!
end
i = 999
result = 0
def is_prime(num)
factor = 2
max = num/2
while factor <= max
if( num%factor == 0 ) then
return false
end
factor+=1
end
return true
prev = 1
current = 1
sum = 0
while( current < 4000000 )
tmp = current
current+=prev
prev = tmp
if current % 2 == 0 then
sum += current
def multiples(num,max)
ret_val = []
max.times() do |i|
ret_val << i if i%num == 0
end
ret_val
end
require 'set'
@yanks
yanks / share_with_jungle_disk.rb
Created January 5, 2012 17:58
Share with Jungle Disk
#!/usr/bin/ruby
require 'base64'
require 'uri'
ARGV.each() do |arg|
#expand
arg = File.expand_path(arg)
pathout = Base64.encode64(arg)
url = "http://localhost:2667/~publish?paths=" + URI.escape(pathout)
puts url
@yanks
yanks / gist:1003937
Created June 2, 2011 04:33
finding anagrams
require 'set'
str = String.new(ARGV[0])
if str.nil? || str.length < 2 then
puts "usage: anagram <string>"
exit
end
anagram_set = SortedSet.new
(0..str.length-1).each do