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
//Created by DhilipSiva | |
//Free to modify and use | |
main() | |
{ | |
char far *videoMemory = 0xB8000000; | |
char *helloString = "Hello World"; | |
int stringLength = 11; //length of "Hello World" is 11 | |
int count; | |
for(count = 0; count < stringLength; count++) |
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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
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
typedef enum { | |
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), | |
UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), | |
UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), | |
UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), | |
UIInterfaceOrientationMaskLandscape = | |
(UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), | |
UIInterfaceOrientationMaskAll = | |
(UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | | |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), |
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
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { | |
return UIInterfaceOrientationIsPortrait(toInterfaceOrientation); | |
} |
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
-(NSUInteger)supportedInterfaceOrientations{ | |
return UIInterfaceOrientationMaskPortrait; | |
} |
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
//Implement this in the MPMediaPickerControllerDelegate | |
-(void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection{ | |
NSString *tempPath = NSTemporaryDirectory(); | |
int i=1; | |
for (MPMediaItem *theItem in mediaItemCollection.items) { | |
NSURL *url = [theItem valueForProperty:MPMediaItemPropertyAssetURL]; | |
AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL:url options:nil]; | |
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName: AVAssetExportPresetPassthrough]; | |
exporter.outputFileType = @"com.apple.coreaudio-format"; |
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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
[self setSession:[[AVCaptureSession alloc] init]]; | |
[_session setSessionPreset:AVCaptureSessionPresetHigh]; | |
[self setViewLayer:self.vPreview.layer]; | |
[self setCaptureVideoPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:_session]]; | |
[_captureVideoPreviewLayer setFrame:[_vPreview bounds]]; |
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
class Foo(object): | |
def __init__(self): | |
self._bar_observers = [] | |
def add_bar_observer(self, observer): | |
self._bar_observers.append(observer) | |
def notify_bar(self, param): | |
for observer in self._bar_observers: | |
observer(param) |
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
curl -L get.rvm.io | bash -s stable --auto | |
sudo apt-get install build-essential libxslt1.1 libxslt1-dev libxml2 ruby-full mysql-server libmysqlclient-dev libmysql-ruby libssl-dev libopenssl-ruby libcurl4-openssl-dev imagemagick libmagickwand-dev git-core redis-server libffi-dev libffi-ruby rubygems libsqlite3-dev libpq-dev libreadline5 openjdk-7-jre nodejs | |
sudo apt-get install ruby-rvm | |
rvm gemset create 'global' | |
rvm install ruby-1.8.7-p370 | |
rvm use ruby-1.8.7-p370@global | |
sudo service mysql start | |
gem install bundler --no-ri --no-rdoc | |
sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle |
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 sys | |
from functools import wraps | |
class TraceCalls(object): | |
""" Use as a decorator on functions that should be traced. Several | |
functions can be decorated - they will all be indented according | |
to their call depth. | |
""" | |
def __init__(self, stream=sys.stdout, indent_step=2, show_ret=False): | |
self.stream = stream |
OlderNewer