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
/** | |
* Description | |
* Accepts a player name as an argument and reads the values | |
* of the track name and artist for the currently playing track | |
* of that player | |
* | |
* @param $player - name of the player to read data from | |
* @return array - array of track name and artist for that player | |
*/ | |
function get_tracks( $players ) |
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
<?php | |
class InvalidMimeGrammar extends \Swift_Mime_Grammar { | |
/** | |
* Get the grammar defined for $name token. | |
* @param string $name exactly as written in the RFC | |
* @return string | |
*/ | |
public function getDefinition($name) | |
{ |
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
/* 配列の配列からオブジェクトを検索しindexPathを返す */ | |
- (NSIndexPath *)indexPathOfItem:(id)item { | |
__block NSIndexPath *indexPath = nil; | |
[groups_ enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
NSInteger row = [(NSArray *)obj indexOfObject:item]; | |
if (row != NSNotFound) { | |
indexPath = [NSIndexPath indexPathForRow:row inSection:idx]; | |
*stop = YES; |
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
NSRange range; | |
NSString *str = @""; | |
if (type == PostTweetTypePublicRepyType) { | |
str = @"Reply"; | |
range = NSMakeRange([str length], 0); | |
} else if (type == PostTweetTypeRetweetType) { | |
str = @"Retweeted"; | |
range = NSMakeRange(0, 0); | |
} if (type == PostTweetTypePublicRepyToUserType) { |
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
UIKIT_EXTERN NSString *const UIApplicationDidEnterBackgroundNotification __attribute__((weak_import)); | |
UIKIT_EXTERN NSString *const UIApplicationWillEnterForegroundNotification __attribute__((weak_import)); |
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
def user_error_handler(func): | |
def wrapped(*args, **kwargs): | |
try: | |
response = func(*args, **kwargs) | |
except (InvalidUser,), e: | |
logger.error('%s: %s' % (func.__name__, str(e),)) | |
response = HttpResponseNotFound('Not found') | |
return response | |
return wrapped |
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
<?php | |
function console_styles() { | |
return array( | |
'heading1' => "\033[1;30;46m", | |
'heading2' => "\033[1;35m", | |
'heading3' => "\033[1;34m", | |
'option' => "\033[40;37m", | |
'command' => "\033[1;40;37m", | |
'error' => "\033[0;31m", |
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
<div id="fb-root"> | |
<script type="text/javascript"> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId: '123456789xxxxxx', | |
status: true, | |
cookie: true, | |
xfbml: true | |
}); | |
}; |
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
tell application "Stickies" | |
activate | |
set w to {} | |
tell application "System Events" | |
tell application process "Stickies" | |
repeat with win in every window | |
set w to w & {position of win} | |
end repeat |
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
+ (NSString *)stringWithGUID { | |
CFUUIDRef uuid = CFUUIDCreate(nil); | |
NSString *str = (NSString*)CFUUIDCreateString(nil, uuid); | |
CFRelease(uuid); | |
return [str autorelease]; | |
} |
OlderNewer