View zephir_helloworld.php
<?php | |
echo HelloWorld\Greeting::say()."\n"; |
View greeting.zep
namespace HelloWorld; | |
class Greeting | |
{ | |
public static function say() | |
{ | |
echo "Hello World!"; | |
} | |
} |
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
View Dynamic programming - knapsack
#Dynamic Programming based Python Program for 0-1 Knapsack problem | |
# Returns the maximum value that can be put in a knapsack of capacity W | |
def knapSack(W, wt, val, n): | |
K = [[0 for x in range(W+1)] for x in range(n+1)] | |
#build table k[][] in bottom up manner |
View knapsack
# input | |
# values stored in array v | |
# wighets stored in array wt | |
#length of array n | |
# knapsack capcity stored in w | |
#A naive recursive implementation of 0-1 Knapsack Problem | |
# Returns the maximum value that can be put in a knapsack of | |
# capacity W | |
def knapSack(w, wt, v, n): |
View gist:a184ba9ae3cf2405b91a
ID3 Pseudocode | |
id3(examples, attributes) | |
''' | |
examples are the training examples. attributes is a list of | |
attributes that may be tested by the learned decison tree. Returns | |
a tree that correctly classifies the given examples. Assume that | |
the targetAttribute, which is the attribute whose value is to be | |
predicted by the tree, is a class variable. | |
''' |