Skip to content

Instantly share code, notes, and snippets.

@jfpoole
jfpoole / gist:3034527
Created July 2, 2012 17:43
Object may not respond to method
if ([[self window] respondsToSelector:@selector(setRestorable:)]) {
// NSLog(@"Disabling restorable documents.");
[[self window] setRestorable:NO];
}
// GCC complains with the following warning:
// warning: ‘NSWindow’ may not respond to ‘-setRestorable:
@jfpoole
jfpoole / gist:4040805
Created November 8, 2012 19:04
exceptional & json gems
Rails::Initializer.run do |config|
# Other stuff
# Gems
config.gem "json"
config.gem "exceptional"
end
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
uint32_t byteswap(uint32_t value)
{
return ((value >> 24) & 0x000000ff) |
((value >> 8) & 0x0000ff00) |
((value << 8) & 0x00ff0000) |
((value << 24) & 0xff000000);
}
@jfpoole
jfpoole / gist:5610229
Created May 20, 2013 03:11
byteswap (clang -O2)
__Z8byteswapj: ## @_Z8byteswapj
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp7:
.cfi_def_cfa_offset 16
Ltmp8:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp9:
// VoodooPad
//
// Copyright (C) 2004-2018 Primate Labs Inc. All Rights Reserved.
//////////////////////////////////////////////////////////////////////////////
#import "VPQTTabViewController.h"
NSString* const VPItemScheme = @"x-voodoopad-item";
@interface VPItemLoaderDelegate : NSObject <AVAssetResourceLoaderDelegate>
#include <stdio.h>
void update(int* variable)
{
*variable = *variable * 2;
}
int main(int, char**)
{
int a = 1;