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
<?php | |
use \Psr\Http\Message\ServerRequestInterface as Request; | |
use \Psr\Http\Message\ResponseInterface as Response; | |
require '../vendor/autoload.php'; | |
$app = new \Slim\App; | |
$app->get('/hello/{name}', function (Request $request, Response $response) { | |
$handleObj = new \My\Namespace\HelloHandler($request, $response); |
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
<?php | |
function getNextProduct($q, callable $f) { | |
$qptr = 0; | |
while (true) { | |
if ($qptr == count($q)) { | |
$qptr = 0; | |
} |
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
var screenshotUrl = 'http://example.com/' | |
var casper = require("casper").create({ | |
viewportSize: { | |
width: 1024, | |
height: 768 | |
} | |
}); | |
if (casper.cli.args.length < 1) { |
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
/* | |
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes. | |
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed | |
* | |
* Usage: | |
* $ casperjs screenshots.js http://example.com | |
*/ | |
var casper = require("casper").create(); |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Data> | |
<Series> | |
<id>83462</id> | |
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors> | |
<Airs_DayOfWeek>Monday</Airs_DayOfWeek> | |
<Airs_Time>10:00 PM</Airs_Time> | |
<ContentRating>TV-PG</ContentRating> | |
<FirstAired>2009-03-09</FirstAired> | |
<Genre>|Drama|</Genre> |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<Data> | |
<Series> | |
<id>83462</id> | |
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors> | |
<Airs_DayOfWeek>Monday</Airs_DayOfWeek> | |
<Airs_Time>10:00 PM</Airs_Time> | |
<ContentRating>TV-PG</ContentRating> | |
<FirstAired>2009-03-09</FirstAired> | |
<Genre>|Drama|</Genre> |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"strconv" | |
) |
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
<?php | |
interface SubscriberInterface { | |
public static function getSubscribedEvents(); | |
} | |
class BlogSubscriber implements SubscriberInterface { | |
public static function getSubscribedEvents() { | |
return array( | |
'blog_update' => 'Listener' | |
); |
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
import aiohttp | |
import asyncio | |
async def get_body(url): | |
response = await aiohttp.request('GET', url) | |
raw_html = await response.read() | |
return raw_html | |
async def main(): | |
# run them sequentially (but the loop can do other stuff in the meanwhile) |
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
# Makefile for a go project | |
# | |
# Author: Jon Eisen | |
# site: joneisen.me | |
# | |
# Targets: | |
# all: Builds the code | |
# build: Builds the code | |
# fmt: Formats the source files | |
# clean: cleans the code |
NewerOlder