Skip to content

Instantly share code, notes, and snippets.

@laullon
laullon / int.asm
Last active February 17, 2020 21:59 — forked from neuro-sys/int.asm
Amstrad CPC interrupts
; https://gist.github.com/neuro-sys/b8bb7187540a17308bf0b3fe0a7836fd
; pasmo --cdt cpc_interrupts.asm cpc_interrupts.cdt
org &8000
start:
di
im 1
@laullon
laullon / arduinoWelder.ino
Last active May 30, 2018 09:45 — forked from k4kfh/arduinoWelder.ino
Non-blocking Object-oriented Arduino Arc Welder Simulator
class Welder
{
public:
Welder(int pin);
void loop(bool welding);
private:
int welderLedPin;
unsigned long currentMillis = 0;
unsigned long previousMillisArc = 0;
@laullon
laullon / OAuthRequestSigner.m
Last active September 3, 2015 23:18 — forked from danpalmer/OAuthRequestSigner.m
Sign OAuth Requests
#import "OAuthRequestSigner.h"
#import <CommonCrypto/CommonCrypto.h>
@implementation OAuthRequestSigner
+(void)signRequestForOAuthRequest:(NSMutableURLRequest *)request
withOAuthParameters:(NSDictionary *)oAuthParameters
consumerSecret:(NSString *)consumerSecret
tokenSecret:(NSString *)tokenSecret
{
Embedding a Core Data model from a static library project
In one of my project, I want to share a Core Data model between 2 projects. I have a common static library project where the model and classes are defined.
SITUATION
a common project that builds a static library which contains my Core Data model (to be shared with an iOS and an OSX project)
my main iOS project
PROBLEM
static library cannot include resources
how can I give make my main project use the Core Data model ?
SOLUTION
@laullon
laullon / gist:2362061
Created April 11, 2012 20:04
Translate Vanity Phone Numbers to only numbers
#import "NSString+Utils.h"
@implementation NSString (Utils)
- (NSString *)translateVanityPhoneNumber
{
NSMutableString *resultString = [NSMutableString stringWithCapacity:self.length];
NSScanner *scanner = [NSScanner scannerWithString:[self uppercaseString]];
NSCharacterSet *set = [NSCharacterSet letterCharacterSet];
while ([scanner isAtEnd] == NO) {
@laullon
laullon / gist:1712104
Created January 31, 2012 18:39
Badge number on a UIButton using MKNumberBadgeView
################################
### UIButton+BPBadgeButton.h ###
################################
#import <UIKit/UIKit.h>
@interface UIButton (BPBadgeButton)
@property (nonatomic) NSUInteger badge;
@end
@laullon
laullon / gist:1690185
Created January 27, 2012 18:30
Open CoverStory after running tests on Xcode 4
on: Edit Scheme >> Test >> Post-action >> Run Script
script:
open -a coverstory ${BUILT_PRODUCTS_DIR}/../../
@laullon
laullon / gist:765282
Created January 4, 2011 19:45
Get the mimetype for a extension. (untested)
-(NSString*)mimeTypeForExtension:(NSString*)ext
{
NSAssert( ext, @"Extension cannot be nil" );
NSString* mimeType = nil;
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(CFStringRef)ext, NULL);
if( !UTI ) return nil;
CFStringRef registeredType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);