Skip to content

Instantly share code, notes, and snippets.

View taion809's full-sized avatar
:shipit:
what are statuses for?

Nicholas Johns taion809

:shipit:
what are statuses for?
View GitHub Profile
func startServing() {
listener, err := net.Listen("tcp", ":11300")
if err != nil {
log.Fatal(err)
}
for {
conn, err := listener.Accept()
if err != nil {
log.Fatal(err)
@taion809
taion809 / TypeResolver.php
Created February 19, 2015 03:30
Type resolver
<?php
/**
* Created by PhpStorm.
* User: njohns
* Date: 1/4/15
* Time: 9:49 AM
*/
namespace Rql\Types;
@taion809
taion809 / User.orm.yml
Created January 18, 2015 16:54
FOSUserBundle User Mapping (YAML)
# src/AppBundle/Resources/config/doctrine/User.orm.yml
AppBundle\Entity\User:
type: entity
table: users
id:
id:
type: integer
generator:
strategy: AUTO

Dockerizing your PHP application

Why?

Why would you want to utilize Docker to package and deliver your application? The most compelling reason, in my mind, is the idea of immutable infrastructure. The ability to run the same exact software on the same infrastructure each time you deploy regarless of when you deploy. I once posted an article describing how I used Docker to contain and deliver a legacy nodejs application. That same application still runs and can be easily deployed to another server and run exactly the same as it did the very first day.

Sounds great, so what do you do?

The first thing is get familiar with the documentation. This article will not discuss the basics of using Docker.

@taion809
taion809 / gist:10730486
Created April 15, 2014 12:59
crappy gorilla tutorial.
Getting Started With Gorilla MUX
===============
###### [Rough Draft.. stop sucking at writing]
I used to have a ton of time. My responsibilities were minimal and I was working remotely from home. Since moving back to The United States I find I have a lot less time. I commute into New York City, which eat's up 2 hours per day, upon returning home I help my wife take care of our son, then I often pass out and start the cycle anew. With that being said, I am now trying to break out of my routine and explore new avenues in programming. Hopefully this series on getting started with the Gorilla Toolkit will be useful to someone else.
Ok, enough of the useless let's get to the useful!
### What are we going to do?
package main
import (
"fmt"
"github.com/gorilla/mux"
"net/http"
)
func HomeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println("Home handler called.. wooo")
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Package",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Package name, including 'vendor-name/' prefix."
},
@taion809
taion809 / Dockerfile
Last active December 27, 2015 19:59
Simple nodejs Dockerfile
FROM ubuntu
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force update
# install python-software-properties for adding PPA's
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python-software-properties
@taion809
taion809 / gist:7135903
Last active December 26, 2015 10:19
PHP l10n i18n links to not forget
http://icu-project.org/apiref/icu4c/classMessageFormat.html#details
http://userguide.icu-project.org/conversion/converters
http://devdocs.io/php/normalizer.normalize
[20:30:13] <sinni800> i dont really have a large project to use it for yet
[20:30:54] <sinni800> but i just wanted to say that... the documentation is pretty much full of one liners
[20:30:58] --> trevor_morse (~trevor_mo@blk-224-145-246.eastlink.ca) has joined #phpc
@taion809
taion809 / Dockerfile
Created October 6, 2013 05:52
Apache and PHP5.5 On Docker
FROM ubuntu
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force update
# install wget, curl, and python-software-properties for adding PPA's
# curl and python-software-properties are not necessary but I like them.
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update; apt-get upgrade -y; apt-get install -y wget curl python-software-properties
# Let's install php 5.5