Skip to content

Instantly share code, notes, and snippets.

View CodeLuca's full-sized avatar
👨‍💻

Luca Marchal CodeLuca

👨‍💻
View GitHub Profile
part of worldcamera;
class Play extends State {
bool timerIsOn = false;
Sprite player;
Group<Sprite> bullets;
Timer bulletTimer;
load() {
game.resourceManager.addBitmapData('ship', 'playerShip1_blue.png');
part of spaceinvader;
class Play extends State {
int score;
Text scoreText;
Sprite player;
Group<Sprite> bullets;
Group<Ufo> ufos;
part of worldcamera;
class Play extends State {
bool timerIsOn = false;
Sprite player;
Group<Sprite> bullets;
Timer bulletTimer;
load() {
game.resourceManager.addBitmapData('ship', 'playerShip1_blue.png');
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'gameDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/notch.png');
game.load.image('pipe', 'assets/dirt.png');
},
create: function() {
game.physics.startSystem(Phaser.Physics.ARCADE);
this.score = 0;
module.exports = function(coordinates) {
var nodeList = '';
var lats = [];
var lons = [];
var total = 0;
for(var i = 0; i < coordinates.length-1; ++i) {
lats.push(coordinates[i].geometry.location.lat);
lons.push(coordinates[i].geometry.location.lng);
}
var fs = require('fs')
var r = fs.readFileSync('read');
r = r.toString();
var rArray = [];
rArray = r.split(' ');
var amount = 0;
for(var i = 0; i < rArray.length; i++){
if(rArray[i] == 'node.'){
amount++;
console.log('true');
This problem is the same as the previous but introduces the concept of modules. You will need to create two files to solve this.
Create a program that prints a list of files in a given directory, filtered by the extension of the files. The first argument is the directory name and the second argument is the extension filter. Print the list of files (one file per line) to the console. You must use asynchronous I/O.
You must write a module file to do most of the work. The module must export a single function that takes three arguments: the directory name, the filename extension string and a callback function, in that order. The filename extension argument must be the same as what was passed to your program. Don't turn it into a RegExp or prefix with "." or do anything except pass it to your module where you can do what you need to make your filter work.
The callback function must be called using the idiomatic node(err, data) convention. This convention stipulates that unless there's an error, the first argume
window.setInterval(function() {
var elem = document.getElementById('data');
elem.scrollTop = elem.scrollHeight;
}, 5000);
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.51/jquery.form.min.js"></script>
<title>File upload Node.</title>
</head>
<body>
<form id="uploadForm"
enctype="multipart/form-data"
action="/api/photo"
17:55:50: OBS 0.8.3 (mac)
17:55:50: CPU Name: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
17:55:50: CPU Speed: 2600MHz
17:55:50: Physical Cores: 2, Logical Cores: 4
17:55:50: Physical Memory: 8192MB Total
17:55:50: OS Name: Mac OS X (NSMACHOperatingSystem)
17:55:50: OS Version: Version 10.10 (Build 14A389)
17:55:50: Kernel Version: 14.0.0
17:55:50: audio settings reset:
samples per sec: 44100