Skip to content

Instantly share code, notes, and snippets.

@segiddins
segiddins / gist:8ba2e42a428014d83e61
Created August 4, 2014 21:02
Check Codesign Versions
find /Applications /Applications/Utilities -maxdepth 1 -name "*.app" | while read a ; do codesign -vd "${a}" 2>&1 | awk '/version/ {print $3}' ; done | sort | uniq -c
@segiddins
segiddins / awesome.json
Last active August 29, 2015 14:06
Resolver Specs format
{
"rack": [
{
"name": "rack",
"version": "0.8",
"platform": "ruby",
"dependencies": {
}
},
{
@segiddins
segiddins / Gemfile
Last active August 29, 2015 14:06
PNG of Dependency Graph
gem 'ruby-graphviz'
@segiddins
segiddins / gen.rb
Created November 25, 2014 21:56
Generate Molinillo integration spec indices from CocoaPods
require 'cocoapods'
master = Pod::SourcesManager.master.first
pods = {}
# names = master.pods
names = %w(AFAmazonS3Client AFNetworking AFOAuth2Client CargoBay)
names.each do |n|
#!/usr/bin/ruby
require 'json'
require 'open-uri'
gems = %w(rails capybara bundler)
specs = []
begin
func drop<S: SequenceType, T where S.Generator.Element == T>(sequence: S, count: Int) -> GeneratorOf<T> {
var generator = sequence.generate()
for _ in 0..<count {
generator.next()
}
return GeneratorOf<T>(generator)
}
#!/usr/bin/env cato 1.2
import Foundation
class OptCls: NSObject {
dynamic var s: String?
dynamic var nos: String = ""
dynamic var nss: NSString?
dynamic var ius: String!
dynamic var i: Int = 0
@segiddins
segiddins / evil.m
Created April 18, 2015 00:14
I swear, I only did this for an experiment
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
IMP imp = imp_implementationWithBlock(^id(id self, id block, id arg){
NSLog(@"self: %@, arg: %@", self, arg);
return self;
});
class_addMethod([NSObject class], @selector (foo), imp, "@@:@");
@segiddins
segiddins / each_ruby
Last active August 29, 2015 14:21
Run a shell command in each rbenv version installed
#!/usr/bin/ruby
versions = `rbenv versions --bare`.split("\n").map(&:strip)
warn "rbenv not installed" && exit(1) unless $?.success?
versions.each do |v|
puts "rbenv shell #{v}"
puts
system({"RBENV_VERSION" => v}, ARGV.join(' '))
puts '-' * 80
@segiddins
segiddins / app
Last active August 29, 2015 14:24
A tiny app launcher
#!/usr/bin/env ruby
app = requested = ARGV.shift
unless File.executable?(app)
escaped_app = app.gsub(/(.)/, '\\\\\1')
app = Dir.glob("/Applications/#{escaped_app}.app/Contents/MacOS/{#{escaped_app},*}").first
end
Process.detach Process.spawn([app, requested], *ARGV, err: '/dev/null', out: '/dev/null')