Skip to content

Instantly share code, notes, and snippets.

View ziadoz's full-sized avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / unfollow.js.md
Created April 26, 2024 19:31 — forked from JamieMason/unfollow.js.md
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
@ziadoz
ziadoz / Laravel-Container.md
Last active January 30, 2024 16:18 — forked from zhilinskiy/Laravel-Container.md
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@ziadoz
ziadoz / artisan_db_open.php
Created February 4, 2020 20:36 — forked from calebporzio/artisan_db_open.php
An artisan command for opening the project's database in TablePlus
<?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 March 16, 2023 13:21 — forked from jlong/uri.js
URI Parsing with Javascript/jQuery
(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 September 5, 2012 22:25 — forked from igorw/FooController.php
Silex convention-based controllers
<?php
// src/Foobar/Controller/FooController.php
namespace Foobar\Controller;
class FooController
{
public function helloAction($request)
{
@ziadoz
ziadoz / meta.php
Created February 29, 2012 23:39 — forked from funkatron/foo.php
PHP 5.4 Meta Programming?
<?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 February 23, 2012 21:29 — forked from anonymous/example.js
JQuery Resize Events
// 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;
}