Skip to content

Instantly share code, notes, and snippets.

@dannyockilson
dannyockilson / laravel
Created September 3, 2014 11:41
Laravel Testing Batch File (note %WEBROOT% is specified as my WAMP root dir)
@echo off
set /p project=What project are you running?
cd %WEBROOT%\%project%
doskey ls = dir
doskey codecept = vendor\bin\codecept run
doskey codeceptf = vendor\bin\codecept run functional
doskey migrate = php artisan migrate
doskey migrateback = php artisan migrate:rollback
@dannyockilson
dannyockilson / gist:52a444195f0df873cc1c
Created March 13, 2015 17:11
Simple Angular Service for WordPress
'use strict';
angular.module('wordpress', [])
.service( 'wpService',
function($http, $q){
var url = 'http://allin.local/wp-json/';
return({
@dannyockilson
dannyockilson / ignore_ctrl
Last active August 29, 2015 14:17
Quick Snippet
// Used Chrome dev tools to find the click event being triggered
$("article.lesson-block").find(".full-center").on("click", function(event) {
// check for ctrl or metakey (mac cmd)
if (!event.ctrlKey && !event.metaKey) {
// if not do your stuff
var t = $(this).parents(".lesson-block").find(".lesson-block-title a").attr("href");
location = t
}
})
@dannyockilson
dannyockilson / config.php
Created April 23, 2015 13:34
quick env example
<?php
// add variables to $_ENV
putenv("TOKEN=USER-API-TOKEN");
putenv("TEAM=USER-TEAM");
putenv("USERNAME=USER-NAME");
// Etc....
// then from your main file
getenv('TOKEN'); // etc
@dannyockilson
dannyockilson / talk-notes.md
Last active September 14, 2015 11:22
Notes from Continuous PHP talk

Continuous Integration

Every branch is tested on every commit/merge Small batches of features in agile sprint style

Continuous Deploy

Adds a release step, build package from branch and deploy Allows quick re-deployment of previous versions if things go wrong Keeps all deploys consistent, dependencies etc are all same versions

@dannyockilson
dannyockilson / tsPaths.js
Last active March 29, 2018 19:06
Quick helper scripts for angular projects
#! /usr/bin/env node
const fs = require('fs');
const files = [
'src/tsconfig.app.json',
'src/tsconfig.server.json',
'src/tsconfig.spec.json'
];
const paths = {
@dannyockilson
dannyockilson / .bashrc
Last active August 1, 2019 09:56
Dev helpers
# Docker Container management
alias docker-rm='docker rm $(docker ps -aq)'
alias docker-st='docker stop $(docker ps -aq)'
alias docker-rm-img="docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi"
# Git Helpers
function gitRmMerged() {
git branch --merged ${1:-master} | grep -v "${1:-master}" | xargs -n 1 git branch -d
}
export -f gitRmMerged
@dannyockilson
dannyockilson / angular.json
Last active November 14, 2018 21:15
Multiple schematics
{
"cli": {
"defaultCollection": "."
}
}
@dannyockilson
dannyockilson / build_all_libraries.js
Created November 29, 2018 12:44
Quick node script to build multiple angular libraries (zero deps, tested on node 8 LTS)
const { spawn } = require('child_process');
const fileName = './angular.json';
let file;
try {
file = require(fileName);
} catch(e) {
console.error(e);
process.exit(1);
@dannyockilson
dannyockilson / <projectRoot>styles.scss
Created February 14, 2019 12:37
Angular + scss(optional) + Tailwindcss
/**
* This injects Tailwind's base styles, which is a combination of
* Normalize.css and some additional base styles.
*
* You can see the styles here:
* https://github.com/tailwindcss/tailwindcss/blob/master/css/preflight.css
*
* If using `postcss-import`, use this import instead:
*
* @import "tailwindcss/preflight";