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
def append_return(n,L): | |
M=L[:] | |
M.append(n) | |
return M | |
def steps(n, L=[]): | |
if n == 0: | |
print L | |
if n >= 1: | |
steps(n-1, append_return(1,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
def append_return(n,L): | |
M=L[:] | |
M.append(n) | |
return M | |
def cents(n,L=[]): | |
global t | |
if n == 0: | |
#print L | |
t+=1 |
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
def memoize(f): | |
cache = {} | |
def decorated_function(*args): | |
if args in cache: | |
return cache[args] | |
else: | |
cache[args] = f(*args) | |
return cache[args] | |
return decorated_function |
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
<?php | |
$filename = 'test.ini'; | |
$iniArray = parse_ini_file($filename, true); | |
var_dump($iniArray); |
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
A basic folder structure to replicate this is as follows: | |
./fopen.php | |
./someIncludeFolder/ | |
./someIncludeFolder/someIncludedFile.php |
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
With hiphop-php, is it possible to save state across requests without using serialize and unserialize. In other words, put something in memory from one request, and pull it in during another request? | |
An example of where this would be beneficial, would be in the Bootstrap process in ZEND. | |
To be able to bootstrap the applciaiton one time before routing, and then save that state, using it over and over again for each subsequent request. |
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
sudo su # become root | |
# yum -y install http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm | |
yum -y install http://mirror.pnl.gov/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
yum -y update | |
# #exclude=kernel necessary in order to build npm package. | |
# If you skip this step 'yum install npm' will fail | |
sed -i 's/exclude=kernel/#exclude=kernel/' /etc/yum.conf | |
yum -y install git nodejs npm redis multitail | |
useradd -p $(perl -e'print crypt("node", "salty")') node | |
useradd -G node -p $(perl -e'print crypt("newuser", "salty")') newuser |
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
root@b8bad52e873c:/app# npm install --save opencv | |
npm info it worked if it ends with ok | |
npm info using [email protected] | |
npm info using [email protected] | |
npm info attempt registry request try #1 at 12:48:42 AM | |
npm http request GET https://registry.npmjs.org/opencv | |
npm http 200 https://registry.npmjs.org/opencv | |
npm info retry fetch attempt 1 at 12:48:43 AM | |
npm info attempt registry request try #1 at 12:48:43 AM | |
npm http fetch GET https://registry.npmjs.org/opencv/-/opencv-3.2.0.tgz |
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 MAX_CHARS = 120; | |
var SPACES_PER_TAB = 4; | |
var MAX_NESTED_CALLBACKS = 3; | |
var MAX_PARAMS = 3; | |
var MAX_STATEMENTS = 10; | |
module.exports = { | |
// http://eslint.org/docs/rules/ |
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
function test() { | |
return new Promise(function(resolveA, rejectA) { | |
// return rejectA('rejectA'); | |
return resolveA('resolveA'); | |
}) | |
.then(function(results) { | |
return new Promise(function(resolveB, rejectB) { | |
return rejectB('rejectB'); |
OlderNewer