Skip to content

Instantly share code, notes, and snippets.

View djekl's full-sized avatar
:octocat:
Working from home

Alan Wynn djekl

:octocat:
Working from home
View GitHub Profile
@assertchris
assertchris / gist:9728147
Created March 23, 2014 19:11
Ah, namespace resolution.
<?php
namespace Tricks\Services\Upload;
use Mockery;
use TestCase;
$headers = [];
function header($value) {
# Tail Laravel and Webserver (NGINX & Apache 2) log files
# Compatible with Laravel 4 & 5
#
alias tl="ls -d /var/log/nginx/* /var/log/apache2/* storage/logs/* app/storage/logs/* storage/laravel.log | grep -v 'gz$' | grep -v '1$' | xargs tail -f"
@tunnckoCore
tunnckoCore / 1-ubuntu-trusty-after-fresh-install.md
Last active August 29, 2015 14:10
Ubuntu 14.04+ (Trusty Tahr) - after fresh install (02 Dec, 2014)

Ubuntu 14.04+ 32bit (ubuntu-mate.org)

Simple steps for installing required tools after fresh Ubuntu install.
Or use installer and uninstaller scripts, they won't break anythng!!

Included

  • Licensed Sublime Text 3 (build 3065)
  • Nginx 1.6.2+ (latest stable)
  • PHP 5.6.4+ (latest stable)
  • NVM v0.22.0+ (for Node.js and NPM)
/**
* Destroy the user's session (logout).
*
* @return Response
*/
public function destroy()
{
Auth::logout();
flash()->info('You are now logged out.');
@caseyamcl
caseyamcl / come-on-really.md
Created February 19, 2015 18:20
Ahhhhhhhhh!!!!

HOLY GAWD PEOPLE..

  • Don't write all your new code on the production machine!
  • Use a VCS!
  • Document your functions using DocBlocks!
  • Document your API (at least LIST the endpoints)... I have to decipher the meaning from your code, and that isn't really clear
  • Use a single identifier as the primary ID in the API for a resource (ie don't return a list of group ids for listing groups and then expect the group name as the identifying parameter for modifying a group)
  • Use a consistent model for representing the same data model in different endpoints!
  • Don't concatenate fields in the API results unless there is a good reason to (e.g first name and last name)
  • Don't expose the underlying database logic. This is leaky abstraction, especially when you do it inconsistently!!
<?php
/**
* @param $path
* @param $extension
*
* @return array
*/
function getFilesInPathWithExtension($path, $extension)
{
@meg87
meg87 / psn_friends.php
Created February 6, 2011 13:33
PHP class to access PlayStation Network friends list.
<?php
// Disable libxml errors and allow user to fetch error information as needed
libxml_use_internal_errors(true);
class PSN_friends
{
public $log_file, $session, $frineds;
function __construct()
{
@djekl
djekl / dabblet.css
Created December 16, 2011 18:40
Apple Style 'Buy Now' Button
/**
* Apple Style 'Buy Now' Button
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
}
@anthonysterling
anthonysterling / tunlr.yql.data.table.xml
Created September 4, 2012 20:44
Simple Tunlr.net YQL Data Table
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<description>Retrieves the IP adddresses for tunlr.net's DNS servers</description>
<author>Anthony Sterling</author>
</meta>
<bindings>
<select produces="JSON">
<execute><![CDATA[
var results = y.query("select content from html where url=\"http://tunlr.net/get-started/\" and xpath='//span[@style = \"font-size: xx-large;\"]'").results.*;
@jamescoverdale
jamescoverdale / XboxAchievement.js
Created September 5, 2012 14:36
PhantomJS - Xbox Achievement JSON (for your latest game)
/*
This script provides a quick and dirty way of getting your most recent game achievement json data.
This is a lightly modified version of Jabbslad's script found here: https://gist.github.com/1653745
James Coverdale - imjam.es 2012
*/
var fs = require('fs'),