php > $x = "foo";
php > $x
php > ;
php >
php > echo $x;
PHP have different namespaces for methods and value attributes.
<?php
class C {
function d() {
return "d-value";
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
from random import randint | |
print "".join(unichr(randint(0, 0x10000)) for i in xrange(100)) |
This file contains 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
#! /usr/bin/env python | |
# coding: utf-8 | |
"""This script reads all .java files from a directory tree and removes unused | |
import statements. It may have errors in detecting import lines (e.g. import | |
lines within block comments, or import lines with another statement in the same | |
line), and it may have false-negatives when deciding to remove an import (i.e. | |
it only removes if the last import symbol word doesn't appear at all - | |
including comments - in the code). |
This file contains 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
#! /usr/bin/env python | |
# coding: utf-8 | |
"""This script reads all .java files from a directory tree and determines if | |
it's necessary to write a Copyright Notice in the beginning of each Java file. | |
It checks that by searching for the word "copyright" in the first few lines. | |
Warning: use it at your own risk. Better have a source control to rollback if | |
necessary. | |
""" |
This file contains 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
# | |
# The probability that two integers randomly chosen are primes between then | |
# is surprisingly related to pi, this probability value is equal to 6/pi**2. | |
# This was discovered by Cesaro, in 1883. | |
# This code uses Monte Carlo method to test 10**7 pairs of random integers between | |
# 1 and 10**10 to approximate numerically the value of pi. | |
# | |
from math import sqrt # square root (to calculate pi from pi**2) |
This file contains 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
# coding: utf-8 | |
from __future__ import division | |
from random import uniform, choice | |
from math import sqrt | |
def euclidean(x, y): | |
"calculates the euclidean distance between two points" | |
assert( len(x) == len(y) ) | |
return sqrt(sum((i-j)**2 for i,j in zip(x,y))) |
This file contains 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
# coding: utf-8 | |
from __future__ import division | |
from random import uniform | |
from math import sqrt | |
def euclidian(x, y): | |
"calculates the euclidian distance between two points" | |
assert( len(x) == len(y) ) | |
return sqrt(sum((i-j)**2 for i,j in zip(x,y))) |
This file contains 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
#! /usr/bin/env python | |
from string import maketrans, lowercase, split | |
G_FOO = 'pgjck' # Googlon special letters | |
G_PREP_C = 'j' # Preposition character | |
G_PREP = 3 # Preposition size | |
G_VERB = 8 # Verb size | |
G_ORDER = 'kgpvbmzfhtxqcrlnjsdw' # Letter ordering | |
G_NUM_MOD = 5 # Pretty number divisor |