Skip to content

Instantly share code, notes, and snippets.

Josh Butts jimbojsb

  • Ziff Davis
  • Austin, TX
View GitHub Profile
View gist:41f8331a0469db4b5ea6f7d690b674c3
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const ip = request.headers.get('cf-connecting-ip');
const ghHeaders = new Headers();
ghHeaders.append("User-agent", "Cloudflare")
response = await fetch('https://api.github.com/meta', {headers: ghHeaders}).then(function(response) {
@jimbojsb
jimbojsb / Docker Tutorial.md
Created Oct 31, 2016
Docker Tutorial Prereqs
View Docker Tutorial.md

For the Containerizing PHP Applications tutorial, if you'd like to follow along, you'll need a working Docker install on your laptop. I'll be using Docker version 1.12, though the versions aren't particularly important for basic concepts.

For Mac users: I strongly recommend you install Docker for Mac (https://docs.docker.com/docker-for-mac/). Docker Toolbox or Docker Machine will work, but they are more complicated and Docker for Mac is the officially recommended way to run Docker on macOS.

For Windows users: I don't have much experience running Docker on Windows, but the new Docker for Windows looks promising, and should be more transparent than using Docker Machine. It does require Windows 10 to work.

For Linux users: Install Docker via the appropriate package manager for your OS.

We will also be using Docker Compose. Docker for Mac and Docker for Windows include a proper version of Docker Compose out of the box. Linux users may need to install a separate package for this.

View docker-compse.yml
web:
build: .
command: /seaglass/docker/bootstrap-dev.sh
ports:
- 20019:80
volumes:
- ~/projects/seaglass:/seaglass
links:
- redis
environment:
View gist:c928ed7248b2296e83d96dc6138dbfa0
FROM offers/baseimage:0.2.2
EXPOSE 80
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/seaglass/vendor/bin
ENV APPLICATION_ENV production
RUN echo "America/Chicago" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
RUN curl https://download.newrelic.com/548C16BF.gpg | apt-key add - && echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
RUN apt-add-repository -y ppa:ondrej/php \
@jimbojsb
jimbojsb / jira-agile.md
Last active Dec 11, 2015
Disable Jira Agile / GreenHopper issue detail view on Kanban Board
View jira-agile.md
  1. Get a user style tool for your browser of choice. I used Stylish for Chrome
  2. Add a stylesheet for your jira hostname with the following:
#ghx-detail-view {
    display: none;
}
@jimbojsb
jimbojsb / README.md
Last active Oct 17, 2015
Zendcon Docker Tutorial README
View README.md

Is there anythign I should read ahead of time?

Probably not, we're going to cover Docker from basic concepts into a working PHP app environment

Should I install any software?

Yes and no. While I will strive to make this session as interactive as possible, working with Docker does involve moving a good bit of data around, and we are at the mercy of Conference Wifi. The tutorial will be geared towards MacOS and Linux users but should be equally doable on Windows, though I have no personal experience using Docker on Windows.

I definitely encourage you to install the software locally and work along with what I'm demonstrating. I will cover basic installation and setup but won't have time to get into issues with anyone's specific system.

I will be working through the content with the following:

  • Docker 1.6.2
View docker-compose.yml
master:
image: private.registry:master
ports:
- 8080
feature123:
image: private.registry:feature123
ports:
- 8081
@jimbojsb
jimbojsb / crawl.php
Created Mar 24, 2015
Entertainment.com Crawler
View crawl.php
<?php
/**
{
"require": {
"symfony/dom-crawler": "2.*",
"symfony/css-selector": "2.*"
}
}
*/
View scalar-type-signatures.php
<?php
// coercive types, as per PersonFactory author's specification
class ElePHPant {
public $name, $age, $cuteness, $evil;
public function __construct(~string $name, ~int $age, ~float $cuteness, ~bool $evil) {
$this->name = $name;
$this->age = $age;
$this->cuteness = $cuteness;
$this->evil = $evil;
@jimbojsb
jimbojsb / tweet.html
Last active Aug 29, 2015
Wes Finder - Javascript Exercise
View tweet.html
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- fill in javascript as necessary -->
<!-- make the characters used counter live-updating as you type -->
<!-- if the user tries to submit the form with more than 140 characters, display a useful error message -->
<script type="text/javascript">
You can’t perform that action at this time.