This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int codes[] = { | |
84, 104, 97, 110, 107, 115, 32, 68, 101, 110, 110, | |
105, 115, 32, 82, 105, 116, 99, 104, 105, 101, 33 | |
}; | |
int len = sizeof(codes)/sizeof(int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Foundation/Foundation.h> | |
@interface Math : NSObject | |
+ (int)factorial:(int)n; | |
@end; | |
@implementation Math | |
+ (int)factorial:(int)n | |
{ | |
if (n == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int factorial(int n) | |
{ | |
if (n == 0) | |
return 1; | |
return n * factorial(n-1); | |
} | |
int main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)captureView:(UIView *)view { | |
CGRect rect = [view bounds]; | |
UIGraphicsBeginImageContext(rect.size); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
[[UIColor blackColor] set]; | |
CGContextFillRect(ctx, rect); | |
[view.layer renderInContext:ctx]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Uncrustify Configuration File | |
# File Created With UncrustifyX 0.3 (176) | |
# | |
# Alignment | |
# --------- | |
## Alignment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Gavin Brock (http://brock-family.org/gavin/perl) - June 2007 | |
#==============================================================================# | |
use strict; | |
use warnings; | |
use Foundation; | |
#==============================================================================# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <stdio.h> | |
#define ANSI_COLOR_GREEN "\x1b[01;32m" | |
#define ANSI_COLOR_RESET "\x1b[0m" | |
void printb(int n) { | |
int i; | |
for (i = 0; i < n; i++) { | |
printf("\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
if [ -z "$1" ]; then | |
echo "specify the file that contains a list of files" | |
exit | |
fi | |
files=$(cat $1) | |
for item in $files ; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set disk size for 512 MB | |
disksize=$((512*(512*4))) | |
# mounting DerivedData virtual disk | |
disknum=$(hdid -nomount ram://$disksize | tr -cd '[0-9]') | |
newfs_hfs -v DerivedData /dev/rdisk$disknum | |
diskutil mount -mountPoint ~/Library/Developer/Xcode/DerivedData /dev/disk$disknum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
COMMANDS = ['major', 'minor', 'patch'] | |
regex = /^([0-9]+)\.?([0-9]*)\.?([0-9]*)/ | |
version = ARGV[0] | |
command = ARGV[1] | |
unless ARGV.size > 1 or version =~ regex |
OlderNewer