This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tap (object) { | |
return new Proxy(object, { | |
get: function (target, attribute) { | |
return function (...args) { | |
target[attribute].apply(target, args); | |
return target; | |
}; | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Notifications\Channels; | |
use Illuminate\Notifications\Notification; | |
class Broadcast extends \Illuminate\Notifications\Channels\BroadcastChannel | |
{ | |
/** | |
* Send the given notification. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Repository; | |
class StarRepositoryController extends Controller | |
{ | |
public function store(Repository $repository) | |
{ | |
// star the repo. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pre { | |
font-size: 13px !important; | |
font-family: 'Operator Mono' !important; | |
line-height: 1.5 !important; | |
} | |
.cm-xml-comment { | |
font-style: italic !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$storage = getcwd() . '/logs/sql.log'; | |
$logger = new \Monolog\Logger('sql'); | |
$logger->pushHandler(new \Monolog\Handler\StreamHandler($storage), \Monolog\Logger::WARNING); | |
$patters = $placeholders = []; | |
$query = $this->toSql(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to use: | |
// 1. Open "Script Editor" (requires OS X 10.10 Yosemite) | |
// 2. Change the language from "AppleScript" to "JavaScript" | |
// 3. Paste the code below and replace the safari example. | |
// | |
// More info: | |
// https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html | |
var sys_events = Application("System Events"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replace_links(tweet) { | |
var pattern = /(http[s:\/a-zA-Z0-9\.\_]+)\b/gm; | |
return tweet.replace(pattern, '<a href="$1">$1</a>'); | |
} | |
function replace_mentions(tweet) { | |
var pattern = /(\@(.+?))\b/gm; | |
var base_url = 'https://twitter.com/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<item>Workflow</item> | |
<item> | |
<name>Change PC Application Key (Menu Key)</name> | |
<item> | |
<name>Application Key to Alfred Launcher</name> | |
<identifier>remap.pc_application2alfred</identifier> | |
<autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::SPACE, ModifierFlag::COMMAND_L</autogen> | |
</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function createAccountFor($type, $name = null, $model) { | |
$parameters = [ | |
'name' => $name, | |
'model_id' => $model->id, | |
]; | |
return factory(Account::class, $type)->create($parameters); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var personCurry = function (name) { | |
return function (greeting) { | |
return function (person) { | |
console.log(greeting + ', ' + person + '! My name is ' + name); | |
} | |
} | |
}; | |
var jaggy = personCurry('Jaggy'); | |
var greet = jaggy('Hi'); |