Skip to content

Instantly share code, notes, and snippets.

@JesseObrien
JesseObrien / gist:7418983
Last active January 31, 2024 06:24
Bind parameters into the SQL query for Laravel ORM
<?php
class MyModel extends Eloquent {
public function getSql()
{
$builder = $this->getBuilder();
$sql = $builder->toSql();
foreach($builder->getBindings() as $binding)
{
@JesseObrien
JesseObrien / Dockerfile
Last active December 14, 2023 17:40
Dockerfile for asp dotnet core with timezone change, npm install, and two-stage build process. This uses the 'aspnetcore-build' container to produce the build with ALL of the SDK dependencies, and the 'aspnetcore' container to run the code itself, cutting down the production container's size.
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN rm -rf node_modules && npm install
@JesseObrien
JesseObrien / titles.html
Created February 19, 2014 19:46
Titles html
<select name="title" id="title">
<option value="">No Title</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Ms">Ms</option>
<option value="Master">Master</option>
<option value="Admiral">Admiral</option>
<option value="Archbsh">Archbishop</option>
<option value="Att Gen">Attorney General</option>
@JesseObrien
JesseObrien / main.go
Created January 16, 2014 04:26
Go composer.json unmarshalling.
package main
import (
"encoding/json"
"fmt"
)
// https://github.com/composer/composer/blob/master/res/composer-schema.json
// http://getcomposer.org/doc/04-schema.md#repositories
// IGNORE THIS -- MIGHT NOT BE USED
@JesseObrien
JesseObrien / folders.txt
Last active September 24, 2019 03:48
Example composer package and file structure.
# Package Folder/File Structure
- src/
- PackageName/
- PackageName.php
- PackageClass.php
- PackageLib.php
- Subfolder/
- OtherLib.php
- tests/
- composer.json
@JesseObrien
JesseObrien / .mutagen.toml
Created June 11, 2019 17:01
Mutagen global ignore/config
[ignore]
default = [
# System files
".DS_Store",
"._*",
# Vim files
"*~",
"*.sw[a-p]",
@JesseObrien
JesseObrien / docker-sync.yml
Created June 11, 2019 15:21
Docker sync setup
version: 2
options:
compose-file-path: 'docker-compose.yml'
compose-dev-file-path: 'docker-compose-dev.yml'
syncs:
admin-app-sync:
sync_strategy: 'native_osx'
src: './'
sync_args:
@JesseObrien
JesseObrien / wsl.md
Created February 23, 2019 15:03
Windows subsystem for linux resources and commands
@JesseObrien
JesseObrien / boxstarter.ps1
Last active January 4, 2019 21:22 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@JesseObrien
JesseObrien / deploy.yml
Created September 5, 2014 13:24
Deploy script for ansible
- hosts: web
vars_files:
- vars.yml
tasks:
- name: Clone Repository
git: repo="git@repo.git" dest=/home/deploy/site version={{ branch }}
notify:
- restart php-fpm service
- restart nginx service