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 | |
$dom = new DOMDocument; | |
libxml_use_internal_errors(true); | |
if (!$dom->loadHTML($data)) { | |
echo 'failed to load DOM'; | |
} | |
$xpath = new DOMXPath($dom); | |
$entries = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " resultBody ")]/@id'); |
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
curl -X POST http://localhost/app/test.php --data @data.txt |
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 | |
use Phalcon\DI\FactoryDefault, | |
Phalcon\Mvc\Micro, | |
Phalcon\Http\Response, | |
Phalcon\Http\Request; | |
$di = new FactoryDefault(); |
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 | |
$out = fopen('php://output', 'w'); | |
fputcsv($out, array('this','is some', 'csv "stuff", you know.')); | |
fclose($out); | |
?> |
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
package main | |
import( | |
"fmt" | |
"github.com/moovweb/gokogiri" | |
) | |
func main() { | |
// Parse even this bad bit of HTML and make it valid | |
html := "<h2>I am so malformatted</h2>" |
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
func doPut(url string) { | |
client := &http.Client{} | |
request, err := http.NewRequest("PUT", url, strings.NewReader("<golang>really</golang>")) | |
request.SetBasicAuth("admin", "admin") | |
request.ContentLength = 23 | |
response, err := client.Do(request) | |
if err != nil { | |
log.Fatal(err) | |
} else { | |
defer response.Body.Close() |
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
package main | |
import ( | |
"github.com/codegangsta/martini" | |
"github.com/russross/blackfriday" | |
"net/http" | |
) | |
func main() { | |
m := martini.Classic() |
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
package main | |
import ( | |
"io" | |
"mime/multipart" | |
"net/http" | |
"os" | |
"strconv" | |
) | |
func UploadHandler(res http.ResponseWriter, req *http.Request) { | |
var ( |
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
$.ajax({ | |
type:"POST", | |
beforeSend: function (request) | |
{ | |
request.setRequestHeader("Authority", authorizationToken); | |
}, | |
url: "entities", | |
data: "json=" + escape(JSON.stringify(createRequestObject)), | |
processData: false, | |
success: function(msg) { |
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
location ~* \.php$ { | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_pass 127.0.0.1:9000; | |
include fastcgi.conf; | |
} |