Skip to content

Instantly share code, notes, and snippets.

View pawel-dubiel's full-sized avatar

Pawel Dubiel pawel-dubiel

View GitHub Profile
@pawel-dubiel
pawel-dubiel / gist:4434040
Created January 2, 2013 11:48
impactjs parallax plugin
/* jerev - 10/2012 - parallax.js
Be sure to require plugins.parallax, and place this file in lib/plugins/
Parallax usage
p = new Parallax();
p.add('path/to/image.ext', {distance: 1, y: 0})
p.add('path/to/other/image.ext', {distance: 5, y: 0})
p.move(speed);
<?php
/**
* print_r converter - convert print_r() to php variable code
*
* Author: hakre <hakre.wordpress.com>
* Copyright (c) 2011, some rights reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@pawel-dubiel
pawel-dubiel / twitter-oauth.js
Created December 10, 2012 04:02 — forked from santosh79/twitter-oauth.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);
@pawel-dubiel
pawel-dubiel / server.js
Created December 10, 2012 04:01 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@pawel-dubiel
pawel-dubiel / robot.js
Created December 6, 2012 00:37 — forked from Shipow/robot.js
Shipow#001
var Robot = function(robot) {
robot.rotateCannon(-90);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead();
//i'll add a clone but i need to refactor collision
//robot.clone();
};
@pawel-dubiel
pawel-dubiel / robot.js
Created December 5, 2012 15:57 — forked from rolemos/robot.js
RoLemosRobot
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@pawel-dubiel
pawel-dubiel / gist:4211094
Created December 5, 2012 01:22 — forked from iyshannon/robot.js
deleted
We couldn’t find that file to show.
@pawel-dubiel
pawel-dubiel / robot.js
Created December 4, 2012 19:31
basicus
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
var save_gun_positon = '';
Robot.prototype.onIdle = function(ev) {
@pawel-dubiel
pawel-dubiel / gist:3802890
Created September 29, 2012 01:52
Javascript optimisation
Some quick notes from http://www.youtube.com/watch?v=UJPdhx5zTaw
Don't mix types ( be sure the array is only of one type )
Don't read out of bounds
Avoid operations with undefined values ( always initialize )
Don't add a new properties to the object during runtime
Initialize all object members in constructor functions
Always initialize object members in the same order
Use 31 bit signed numbers in critical calculations
Don't preallocate arrays elements
Don't delete elements from arrays
@pawel-dubiel
pawel-dubiel / gist:3802709
Last active October 11, 2015 04:27
Setting up a new domain #script
#!/bin/bash
echo "Enter a host name (e.g. example.com):";
read domain;
echo ""
echo 'IP ADDRESSES'
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
echo "Enter IP ADDRESS:";
read ipaddress;