Skip to content

Instantly share code, notes, and snippets.

View dimmduh's full-sized avatar
🎮
Learning Unity

Dmitrii Dukhnich dimmduh

🎮
Learning Unity
View GitHub Profile
@dimmduh
dimmduh / gist:2822123
Created May 29, 2012 01:58
Using Google Reader Class
<?php
$google_reader = new GoogleReaderAPI( 'gmail@gmail.com', 'password' );
$unread_items = $google_reader ->get_unread(50);
foreach( $unread_items -> items as $val ){
//print_r( $val );
$ar_news = array(
'title' => $val -> title,
<?php
function url_exists($url) {
$headers = @get_headers($url);
return ($headers[0] == 'HTTP/1.1 200 OK' || $headers[0] == 'HTTP/1.0 200 OK');
}
private void copyDataBase() throws IOException{
// Path to the just created empty db
String outFileName = DB_PATH + DB_NAME;
//Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
generator.enemies = {
{ t = 1000, enemyType = 'worm' },
{ t = 3000, enemyType = 'worm' },
{ t = 6000, enemyType = 'worm' },
{ t = 10000, enemyType = 'worm' },
{ t = 10000, enemyType = 'worm' },
{ t = 12000, enemyType = 'worm' },
}
--usefull functions
function p(t)
print( t )
end
--@see http://lua-users.org/wiki/MathLibraryTutorial
math.randomseed( os.time() )
_W, _H = display.contentWidth, display.contentHeight
--генератор врагов в точке респауна
--создает экземпляры объектов в необходимое время
EnemyGenerator = {}
function EnemyGenerator:new(params)
local generator = {}
--координаты появления
generator.x = params.x
function bullet:enterFrame(e)
if ( self:isOut() ) then
self:destroy();
end
...
self:checkCollision()
end
function bullet:enterFrame(e)
if ( self:isOut() ) then
self:destroy();
return true;
end
...
self:checkCollision()
end
function bullet:enterFrame(e)
if (self.destroyed) then
self:destroy()
return true;
end
if ( self:isOut() ) then
self.destroyed = true;
end
<?php
//парсинг баша.орг.ру
#error_reporting(0);
set_time_limit(0);
ini_set('memory_limit', '512M');
$db = new SQLite3('bash');
#$db->query('DELETE FROM quotes;');