Skip to content

Instantly share code, notes, and snippets.

View jimbojsb's full-sized avatar

Josh Butts jimbojsb

View GitHub Profile
@jimbojsb
jimbojsb / gist:41f8331a0469db4b5ea6f7d690b674c3
Created July 24, 2018 04:51
Cloudflare Github Validation
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 October 31, 2016 14:38
Docker Tutorial Prereqs

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.

@jimbojsb
jimbojsb / docker-compse.yml
Created July 28, 2016 14:22
docker compose dev
web:
build: .
command: /seaglass/docker/bootstrap-dev.sh
ports:
- 20019:80
volumes:
- ~/projects/seaglass:/seaglass
links:
- redis
environment:
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 December 11, 2015 15:28
Disable Jira Agile / GreenHopper issue detail view on Kanban Board
  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 October 17, 2015 20:58
Zendcon Docker Tutorial README

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
master:
image: private.registry:master
ports:
- 8080
feature123:
image: private.registry:feature123
ports:
- 8081
@jimbojsb
jimbojsb / crawl.php
Created March 24, 2015 15:34
Entertainment.com Crawler
<?php
/**
{
"require": {
"symfony/dom-crawler": "2.*",
"symfony/css-selector": "2.*"
}
}
*/
<?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 August 29, 2015 14:17
Wes Finder - Javascript Exercise
<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">