Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / artisan_db_open.php
Created Feb 4, 2020 — forked from calebporzio/artisan_db_open.php
An artisan command for opening the project's database in TablePlus
View artisan_db_open.php
<?php
Artisan::command('db:open {connection?}', function ($connection = null) {
if (! file_exists('/Applications/TablePlus.app')) {
$this->warn('This command uses TablePlus, are you sure it\'s installed?');
$this->line("Install here: https://tableplus.com/\n");
}
$driver = $connection ?: config('database.default');
$host = config("database.connections.{$driver}.host");
@ziadoz
ziadoz / highlighting.js
Last active Jun 28, 2018 — forked from jlong/uri.js
URI Parsing with Javascript/jQuery
View highlighting.js
(function($) {
$(document).ready(function() {
// Highlight Navigation
var url = $.parseUrl(document.location);
$('a').each(function() {
var link = $.parseUrl(this.href);
if (link.pathname !== '' && link.pathname === url.pathname) {
$(this).siblings().removeClass('active');
$(this).addClass('active');
}
@ziadoz
ziadoz / FooController.php
Created Sep 5, 2012 — forked from igorw/FooController.php
Silex convention-based controllers
View FooController.php
<?php
// src/Foobar/Controller/FooController.php
namespace Foobar\Controller;
class FooController
{
public function helloAction($request)
{
@ziadoz
ziadoz / meta.php
Created Feb 29, 2012 — forked from funkatron/foo.php
PHP 5.4 Meta Programming?
View meta.php
<?php
// See: https://gist.github.com/1942528
trait Call_Dynamic_Methods
{
public function __call($name, $arguments)
{
if (isset($this->{$name}) && $this->{$name} instanceof Closure) {
$this->{$name} = $this->{$name}->bindTo($this, $this);
return call_user_func_array($this->{$name}, $arguments);
}
@ziadoz
ziadoz / example.js
Created Feb 23, 2012 — forked from anonymous/example.js
JQuery Resize Events
View example.js
// See: http://ejohn.org/blog/learning-from-twitter/
(function($) {
$(document).ready(function() {
var resizeCallable = function() {
switch (true)
{
case (window.innerWidth <= 768):
// Do some exciting device size specific magic here.
break;
}
You can’t perform that action at this time.