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 | |
| // From presentation-layer/application/modules/user/models/Givingpage.php | |
| protected function _setIf($givingPage, $data, $key, $field = null) | |
| { | |
| if ($field === null) { | |
| $field = $key; | |
| } | |
| if (isset($data[$key])) { |
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 | |
| // Micro-benchmarks, again, see http://daveyshafik.com/archives/30320-faster-arrays.html | |
| // Results: | |
| // | |
| // regular 1.64 | |
| // preallocated 1.42 | |
| // fixed 0.81 |
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 | |
| function isStringPresent($needle, $haystack) | |
| { | |
| $result = strstr($haystack, $needle); | |
| if ($result == FALSE) { | |
| return FALSE; | |
| } else { | |
| return TRUE; | |
| } |
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
| From 4d80c2dc876e7bffde2b23825587518c4bd7b678 Mon Sep 17 00:00:00 2001 | |
| From: Michael Stillwell <[email protected]> | |
| Date: Thu, 10 Mar 2011 23:23:12 +0000 | |
| Subject: [PATCH] Only emit error on request if request can be found. | |
| If the socket receives a "ECONNRESET, Connection reset by peer" error, the http error handler tries to find the associated request from the request queue. However at this point in time, all requests may have been satisfied (e.g. by other sockets) and the queue empty. | |
| --- | |
| lib/http.js | 15 +++------------ | |
| 1 files changed, 3 insertions(+), 12 deletions(-) |
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 http = require('http'); | |
| var options = { | |
| host: 'pix04.revsci.net', | |
| port: 80, | |
| path: '/H07707/b3/0/3/0806180/551104974.js?D=DM_LOC%3Dhttp%253A%252F%252Fwww.nytimes.com%252F2011%252F03%252F11%252Fworld%252Fafrica%252F11policy.html%253F_r%253D2%2526hp%26DM_CAT%3DNYTimesglobal%2520%253E%2520World%2520%253E%2520Africa%26DM_REF%3Dhttp%253A%252F%252Fwww.nytimes.com%252F2011%252F03%252F11%252Fworld%252Fafrica%252F11policy.html%253F_r%253D2%2526hp%26DM_EOM%3D1&C=H07707', | |
| headers: { host: 'pix04.revsci.net', | |
| 'user-agent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13', | |
| accept: '*/*', | |
| 'accept-language': 'en-us,en;q=0.5', |
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
| // SYNCHRONOUS MAP | |
| function smap(src, fn) { | |
| if (src.length == 0) { | |
| return []; | |
| } else { | |
| return [fn(src[0])].concat(smap(src.slice(1), fn)); | |
| } | |
| } |
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
| # Do not name this twisted.py or Python's loader will get | |
| # confused! | |
| from twisted.web import proxy, http | |
| from twisted.internet import reactor | |
| from twisted.python import log | |
| import sys | |
| # log.startLogging(sys.stdout) |
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
| import SocketServer | |
| import SimpleHTTPServer | |
| import urllib | |
| PORT = 8080 | |
| class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(200) | |
| self.end_headers() |
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 http = require('http'); | |
| var url = require('url'); | |
| http.createServer(function (req1, res1) { | |
| var tmp = url.parse(req1.url); | |
| var options = { | |
| "host": tmp.hostname, | |
| "port": tmp.port || 80, | |
| "path": tmp.pathname + (tmp.search ? tmp.search : ''), | |
| "method": req1.method, |
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
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <script> | |
| function jjjjj(arg) { | |
| var post = arg.posts[0]; | |
| console.log(post); | |
| document.write(post["regular-body"]); | |
| } |