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
#To check which programs are running on which ports | |
sudo lsof -i :80 # checks port 80 | |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
haproxy 32850 root 4u IPv4 0xf27d639a63f41339 0t0 TCP *:http (LISTEN) | |
#To watch changes to a given folder | |
#To install this command on mac check out this link: http://osxdaily.com/2010/08/22/install-watch-command-on-os-x | |
watch -d ls -l |
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 flight = { | |
airline: "Oceanic", | |
number: 815, | |
//you can have nested objects | |
departure: { | |
IATA: "SYD", | |
time: "2004-09-22 14:55", | |
city: "Sydney" | |
}, | |
arrival: { |
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
//Reflection | |
//"typeof" does it for you | |
console.log(typeof flight.number); // 'number' | |
console.log(typeof flight.arrival); // 'object' | |
console.log(typeof flight.manifest); // 'undefined' | |
console.log(typeof flight.toString); // 'function' | |
console.log(typeof flight.constructor); // 'function' | |
/* | |
If you would like to access an object property and want the value of the child not the parent's, you can use "hasOwnProperty" |
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
abstract class Forme { | |
protected String couleur; | |
public void changerCouleur(String nouveauCouleur){ | |
this.couleur = nouveauCouleur; | |
} | |
protected abstract void deplacer(float dx, float dy); | |
} |
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 function allows you to add a number of omniture tags and once they are all assigned non empty values, | |
* they will be automatically submitted to the server | |
* @returns {{addTag: addTag, updatedTag: updatedTag}} | |
* @constructor | |
*/ | |
var OmnitureTagger = function() { | |
var tags = {}; | |
for (var i=0;i < arguments.length;i++) { |
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
//Loading files dynamically | |
function loadjscssfile(filename, filetype){ | |
if (filetype=="js"){ //if filename is a external JavaScript file | |
var fileref=document.createElement('script') | |
fileref.setAttribute("type","text/javascript") | |
fileref.setAttribute("src", filename) | |
} | |
else if (filetype=="css"){ //if filename is an external CSS file | |
var fileref=document.createElement("link") |
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
//to run geth client | |
geth --datadir=./chaindata/ --rpccorsdomain "*" --rpc --rpcport "8585" --rpcaddr 0.0.0.0 -rpcapi="db,eth,net,web3,personal,web3" | |
//start the interactive geth shell | |
geth attach /Users/adilmezghouti/development/ether-lab/chaindata/geth.ipc | |
//make the geth command available system wide | |
export PATH="/Users/adilmezghouti/development/geth-alltools-darwin-amd64-1.7.2-1db4ecdc:$PATH" | |
//Initilaize the local ethereum node |
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
pragma solidity ^0.4.0; | |
contract EIP20Interface { | |
/* This is a slight change to the ERC20 base standard. | |
function totalSupply() constant returns (uint256 supply); | |
is replaced with: | |
uint256 public totalSupply; | |
This automatically creates a getter function for the totalSupply. | |
This is moved to the base contract since public getter functions are not | |
currently recognised as an implementation of the matching abstract |
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 function allows you to add a number of omniture tags and once they are all assigned non-empty values, | |
* they will be automatically submitted to the server | |
* @returns {{addTag: addTag, updatedTag: updatedTag}} | |
* @constructor | |
*/ | |
var OmnitureTagger = function() { | |
var tags = {}; | |
for (var i=0;i < arguments.length;i++) { |