Skip to content

Instantly share code, notes, and snippets.

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
@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
@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 / 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 / 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: