The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: October 8th 2015
- Original post
@setup | |
function env(string $key) { | |
$dotenv = file_get_contents('.env'); | |
$rows = explode("\n", $dotenv); | |
$search = array_filter($rows, function ($row) use ($key) { | |
if (strstr($row, $key)) { | |
return $row; | |
} | |
}); |
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'); |
<?php | |
function createAccountFor($type, $name = null, $model) { | |
$parameters = [ | |
'name' => $name, | |
'model_id' => $model->id, | |
]; | |
return factory(Account::class, $type)->create($parameters); | |
} |
<?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> |
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/'; |
// 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"); |
<?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(); |
pre { | |
font-size: 13px !important; | |
font-family: 'Operator Mono' !important; | |
line-height: 1.5 !important; | |
} | |
.cm-xml-comment { | |
font-style: italic !important; | |
} |
<?php | |
use App\Repository; | |
class StarRepositoryController extends Controller | |
{ | |
public function store(Repository $repository) | |
{ | |
// star the repo. | |
} |