Skip to content

Instantly share code, notes, and snippets.

@40
40 / gist:1379128
Created November 19, 2011 17:56
Install LAMP (php w/mysql) on Ubuntu Linux Server
aptitude update;
aptitude upgrade;
aptitude install apache2 mysql-server php5 php5-mysql;
y;
clear;
cd /var/www;
ssh root@[yourServerIPAddress] -p
[your root password]
@40
40 / mongoDBInstall
Created December 22, 2011 00:12
Install mongoDB on Ubuntu Linux Distribution
#add line to sources.list inside /etc/apt/sources.list
sudo vim /etc/apt/sources.list
i
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
ESC
:wq
# update "/etc/apt/sources.list"
sudo apt-get update
@40
40 / boilerplate.coffee
Created February 27, 2012 18:14 — forked from bytespider/boilerplate.coffee
jsOAuth boilerplate for PIN based authentication in javascript
openAuthoriseWindow = (url) ->
waitForPin = ->
if wnd.closed
pin = prompt("Please enter your PIN", "")
oauth.setVerifier pin
oauth.fetchAccessToken getSomeData, failureHandler
else
setTimeout waitForPin, 100
wnd = window.open(url, "authorise")
setTimeout waitForPin, 100
@40
40 / gist:1944636
Created February 29, 2012 21:39
HTML5 Notifications API Implementation
//request permission
function askPermission(){
webkitNotifications.requestPermission(testNotification);
}
//send notification
function testNotification(){
var notification =
webkitNotifications.createNotification('IMAGE','TITLE','BODY');
notification.show();
@40
40 / gist:1944669
Created February 29, 2012 21:45
AJAX load html file into div (jquery)
$('#result').load('ajax/test.html', function() {
alert('Load was performed.');
});
@40
40 / gist:1953580
Created March 1, 2012 22:06
Javascript KeyCode Mappings
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
@40
40 / gist:2178291
Created March 24, 2012 04:31
:Pixelate Image in HTML5 Canvas
function focusImage(canvas, context, imageObj, pixelation){
var sourceWidth = imageObj.width;
var sourceHeight = imageObj.height;
var sourceX = canvas.width / 2 - sourceWidth / 2;
var sourceY = canvas.height / 2 - sourceHeight / 2;
var destX = sourceX;
var destY = sourceY;
var imageData = context.getImageData(sourceX, sourceY,
sourceWidth, sourceHeight);
var data = imageData.data;
@40
40 / gist:2218283
Created March 27, 2012 17:41
Super User ROOT MySQL Password DB Reset
Step # 1 : Stop mysql service
/etc/init.d/mysql stop
Step # 2: Start to MySQL server without password:
mysqld_safe --skip-grant-tables &
Step # 3: Connect to mysql server using mysql client:
mysql -u root
Step # 4: Setup new MySQL root user password
@40
40 / gist:2335029
Created April 8, 2012 05:41
Enable mod_rewrite in apache 2+ ubuntu distro
#COMMANDS
cd /etc/apache2/mods-enabled
touch rewrite.load
vi rewrite.load
#INSERT CODE
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
#EDIT IN
/etc/apache2/sites-available/default