Skip to content

Instantly share code, notes, and snippets.

View Cosmicist's full-sized avatar
🏴

Luciano Longo Cosmicist

🏴
  • Buenos Aires, Argentina
View GitHub Profile
@fideloper
fideloper / SlackOAuthController.php
Last active February 17, 2017 22:57
Slack oAuth2.0 Round Trip
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use GuzzleHttp\Client;
@martinbean
martinbean / pre-commit
Last active December 19, 2023 22:14
Pre-commit hook to detect if any .php files contain dd()
#!/usr/bin/php
<?php
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD | grep "\.php$"');
$files = explode("\n", trim($files));
$exitCode = 0;
foreach ($files as $file) {
if (empty($file)) {
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active September 23, 2023 09:38
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@maxim
maxim / gh-dl-release
Last active April 29, 2024 08:55
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@morrisonlevi
morrisonlevi / Why ES6 arrow functions won't work in PHP.md
Last active February 2, 2018 09:19
Using the syntax for ES6 arrow functions wouldn't work in PHP. Here's why and how we could work around it.

In EcmaScript 2015 (ES6) the expression (x) => x * 2 means to create an anonymous function with one parameter x that will return x * 2. For example:

(x) => x * 2
// is equivalent to:
function(x) { return x * 2; }

A modified example from [documentation by Mozilla Developer Network][1] page demonstrates how they are useful:

var a = [

"Hydrogen",

@greydnls
greydnls / specification.tpl
Created September 4, 2015 14:30
PHPSpec template php5
<?php
namespace %namespace%;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class %name% extends ObjectBehavior
{
function it_is_initializable()
@kkiernan
kkiernan / index.html
Last active May 4, 2022 05:19
A Vue.js filter that formats a phone number.
<input type="text"
name="home_phone"
class="form-control"
v-model="homePhone | phone"
lazy>
@nadar
nadar / PostMessageToSlackChannel.php
Last active April 19, 2024 13:44
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit:
*
* 1.) Create an APP -> https://api.slack.com/apps/
* 2.) See menu entry "Install App"
* 3.) Use the "Bot User OAuth Token"
@tomgraion
tomgraion / radio.sh
Created April 21, 2015 14:11
This is a function to play radios from a txt in mplayer in Linux.
function radio (){
mplayer `cat radios.txt | grep "$1" | grep -o 'http.*$' `
}
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;