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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Test Page</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var array1 = [1, 2]; | |
Object.defineProperty(Array.prototype, "test", {value : 1, |
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
// $ node rename.js | |
var fs = require('fs'); | |
var path = '/Users/max/Downloads/test/'; | |
fs.readdir(path, function(err, files) { | |
files.forEach(function (val, index, array) { | |
if(val.match(/mp4$/)) fs.renameSync(path + val, path + unescape(val)); | |
}); | |
}); |
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
var oauth = require('oauth-client'); | |
var consumerKey = '', | |
consumerSecret = '', | |
oauthToken = '', | |
oauthTokenSecret = ''; | |
var consumer = oauth.createConsumer(consumerKey, consumerSecret); | |
token = oauth.createToken(oauthToken, oauthTokenSecret); | |
signer = oauth.createHmac(consumer, token); |
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
var list:SerialList = new SerialList(); | |
for (var i:int = 1; i<=3; i++) { | |
var className:String = "Item" + i + "Btn"; | |
var customClass:Class = getDefinitionByName( className ) as Class; | |
itemsArray[i] = new customClass(); | |
list.addCommand( new AddChild(container, itemsArray[i]) ); | |
} | |
list.execute(); |
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
// http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:migrate_to_v2.0#ccdirector | |
// CCTouchDispatcher | |
// v1.0 | |
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self | |
priority:0 | |
swallowsTouches:YES]; | |
// v2.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
// http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:migrate_to_v2.0#ccdirector | |
// cocos2d v2.0 | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
NSLog(@"interfaceOrientation: %d", interfaceOrientation); | |
return UIInterfaceOrientationIsLandscape(interfaceOrientation); | |
} | |
{ |
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 <Wire.h> | |
#include "BlinkM_funcs.h" | |
#define blinkm_addr 0x00 | |
int val; | |
void setup(){ | |
Serial.begin(9600); | |
pinMode(13,OUTPUT); |
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 <Arduino.h> | |
#include <SPI.h> | |
#include "ble.h" | |
#include <Wire.h> | |
#include "BlinkM_funcs.h" | |
#define blinkm_addr 0x00 | |
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 <Arduino.h> | |
#include <SPI.h> | |
#include "ble.h" | |
#include <Wire.h> | |
#include "BlinkM_funcs.h" | |
// blinkM | |
#define blinkm_addr 0x00 |
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)orientationChanged:(NSNotification *)notification { | |
NSLog(@"%s", __func__); | |
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; | |
CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame]; | |
float statusBarHeight = (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) ? statusBarViewRect.size.width : statusBarViewRect.size.height; | |
float heightPadding = statusBarHeight + self.navigationController.navigationBar.frame.size.height; | |
[self.tableView setContentInset:UIEdgeInsetsMake(heightPadding, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right)]; | |
} |
OlderNewer