This file contains hidden or 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
evolveWeight: function () { | |
var step = 0.01; | |
var index_to_decrease = Enemy.TypeWeight.indexOf(getBiasedRandomItem(Enemy.TypeWeight, Enemy.TypeWeight)); | |
var min = Math.min.apply(Math, Enemy.TypeWeight); | |
var index_to_increase = Enemy.TypeWeight.indexOf(min); | |
Enemy.TypeWeight[index_to_increase] += step; | |
Enemy.TypeWeight[index_to_decrease] -= step; | |
cc.log("Weight: " + Enemy.TypeWeight); |
This file contains hidden or 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 audioEngine = cc.AudioEngine.getInstance(); | |
var MainLayer = cc.LayerColor.extend({ | |
_enemies: [], | |
_projectiles: [], | |
_enemiesDestroyed: 0, | |
_timer: 0, | |
_pauseButton: null, |
This file contains hidden or 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 appFiles = [ | |
'./Src/resource.js', | |
'./Src/MainLayer.js', | |
'./Src/GameOver.js', | |
'./Src/Enemy.js', | |
'./Src/Projectile.js', | |
'./Src/BiasedRandomGenerator.js' | |
]; | |
This file contains hidden or 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
this.options.uploadPath = this.options.uploadServer + '/upload?' + toURIParams({ | |
timestamp : this.options.timestamp, | |
app_id : this.options.app, | |
id : this.options.id, | |
identifier : this.options.identifier, | |
title : this.options.name, | |
url : this.options.url, | |
tags : this.options.tags, | |
screens : this.options.screens, | |
css : this.options.css, |
This file contains hidden or 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 node_io = require("node.io"); | |
function methods(input){ | |
var _methods = { | |
input:input, | |
run: function(url) { | |
this.getHtml(url, function(err, $) { | |
var items = []; | |
$('li.item').each(function (li){ |
This file contains hidden or 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
@interface NSManagedObject (Serialization) | |
- (NSDictionary*) toDictionary; | |
- (void) populateFromDictionary:(NSDictionary*)dict; | |
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict | |
inContext:(NSManagedObjectContext*)context; | |
@end |
This file contains hidden or 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 http = require('http'); | |
var url = require('url'); | |
var activeState = "0"; | |
var reqCounter = 0; | |
var server = http.createServer(function (req, res) { | |
console.log("____________________________"); | |
console.log("URL:", decodeURIComponent(req.url)); |
This file contains hidden or 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 crypto = require('crypto'); | |
var AESCrypt = {}; | |
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) { | |
encryptdata = new Buffer(encryptdata, 'base64').toString('binary'); | |
var decipher = crypto.createDecipheriv('aes-128-cbc', cryptkey, iv), | |
decoded = decipher.update(encryptdata); |
This file contains hidden or 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 http = require('http'); | |
var url = require('url'); | |
var crypto = require('crypto'); | |
var AESCrypt = {}; | |
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) { | |
encryptdata = new Buffer(encryptdata, 'base64').toString('binary'); | |
var decipher = crypto.createDecipheriv('aes-128-cbc', cryptkey, iv), | |
decoded = decipher.update(encryptdata, 'binary', 'utf8'); |
This file contains hidden or 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 System.Directory | |
import Control.Monad (filterM, mapM, liftM) | |
import System.FilePath ((</>)) | |
getDirsRec :: FilePath -> IO [FilePath] | |
getDirsRec d = do | |
dirContents <- getDirectoryContents d | |
let dirContents' = [ d </> x | x <- dirContents, x /= ".", x /= ".." ] | |
dirs' <- mapM dirRec dirContents' | |
return (concat dirs' ++ [d]) |
OlderNewer