Skip to content

Instantly share code, notes, and snippets.

View MarkVillacampa's full-sized avatar
:octocat:
just setting up my gthb

Mark Villacampa MarkVillacampa

:octocat:
just setting up my gthb
View GitHub Profile
@MarkVillacampa
MarkVillacampa / download.sh
Created June 9, 2017 14:00
Download all 2017 video sessions in SD quality and PDF. Requires jq (https://stedolan.github.io)
curl -O --compressed https://devimages-cdn.apple.com/wwdc-services/h8a19f8f/049CCC2F-0D8A-4F7D-BAB9-2D8F5BAA7030/contents.json
jq '.contents[] | { title: .title, media: .media.downloadSD, id: .id } | if (.id | test(".*2017.*")) then . else empty end | if .media then .media else empty end' contents.json | xargs -n 1 wget -nc
jq '.contents[] | { title: .title, media: .media.slides, id: .id } | if (.id | test(".*2017.*")) then . else empty end | if .media then .media else empty end' contents.json | xargs -n 1 wget -nc
@MarkVillacampa
MarkVillacampa / extract_static_lib.sh
Last active April 11, 2023 07:44
Simple script to extract all the object files (.o) from a static library. By default it extracts the x86_64 architecture but can be easily changed. This is useful to inspect static libraries with Hopper (http://www.hopperapp.com) (You can inspect static libraries with Hopper but it will make you choose with .o file you want to inspect each time).
#!/usr/bin/env bash
lipo -extract_family x86_64 $1 -o $1_thin
mkdir $1_objs
cd $1_objs
ar -x ../$1_thin
@MarkVillacampa
MarkVillacampa / cache.rb
Last active April 14, 2016 00:17
Very simple demonstration of NSHashTable in RubyMotion
class MyObject
attr_accessor :my_id
def isEqual(object)
object.class == self.class && object.my_id == my_id
end
def hash
my_id.hash
end
class AppDelegate
def application(application, didFinishLaunchingWithOptions:options)
if options && options[UIApplicationLaunchOptionsRemoteNotificationKey]
# The application was completely closed and the user launched it by tapping on a notification
else
# The application was completely closed and the user launched it by tapping on the app's icon
end
end
@MarkVillacampa
MarkVillacampa / gist:90641be52bb5a2ecba4e
Last active August 29, 2017 14:07
WWDC 2015 RubyMotion work list
@MarkVillacampa
MarkVillacampa / gist:eafdb0a81c0b9c953256
Created September 1, 2014 08:50
Motion-coderunner: use bridge support from an arbitrary header file
header_file = "mach-o/dyld.h"
bridgesupport_file = "#{header_file.tr('/', '_').chomp('.h')}.bridgesupport"
system("/usr/bin/gen_bridge_metadata --format complete --64-bit --cflags -I/usr/include #{header_file} > #{bridgesupport_file}")
bs_frameworks << " --uses-bs #{File.join(Dir.pwd, bridgesupport_file)}"
@MarkVillacampa
MarkVillacampa / JavaScriptCore.m
Last active December 27, 2015 19:49
Trying to add methods at runtime for the JSExport protocol in JavaScriptCore. As-is, the method is not called from Javascript. Uncomment lines 7-8 and the end of 11, comment line 65, and run. The method is now called from JavaSript. Any idea why?
#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h>
#import <objc/runtime.h>
const char *_protocol_getMethodTypeEncoding(Protocol *, SEL, BOOL isRequiredMethod, BOOL isInstanceMethod);
//@protocol MyProtocol <JSExport>
// -(void)one:(id)one;
//@end
@MarkVillacampa
MarkVillacampa / Tweetbot-football-filter
Last active December 21, 2015 22:08
Filtro para Tweetbot de fútbol
(?i)gol|partidos*|[a|á]rbitros*|bal[o|ó]n|f[u|ú]tbol|neymar|mou|messi|ronaldo|atleti|barça|real madrid|penaltis*|villarato|atl[e|é]tico|busquets|vald[e|é]s|piqué