Skip to content

Instantly share code, notes, and snippets.

$validWiths = [
'a' => 'a',
'b' => 'b',
'translated' => static function ($query) {
$query->withTrashed();
}
];
$with = $request->get('with');
$mealQuery = \App\Meal::query();
<?php
$users = \App\Models\User::all();
factory(Person::class, 10)
->create()
->each(
static function (Person $person) use ($users) {
$person->user_id = $users->random()->first()->id;
}
);
<?php
class Player {
public function __construct()
{
$this->drawPile = new Collection();
$this->drawPile->whenEmpty(function ($collection) {
return $this->recycleDiscardPile();
})
}
<?php
return [
// page_id => [fieldset, fieldset]
1 => ['video', 'gallery'],
2 => ['gallery'],
102 => ['video']
];
on *:text:!burrito*:#thedivisiongame,#ngon,#z28ryank,#mattgoesbuck,#olafurw: {
if ($2 != $null) {
/var %to = $2-
}
else {
/var %to = $nick($chan,$r(1,$nick($chan,0,r)),r)
}
/msg $chan here, %to - have a Burrito - courtesy of $nick
}
<?php
function render_acf_content( $field_name = 'page_layout', $post_id = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
if ( is_home() ) {
$post_id = get_option( 'page_for_posts' );
}
}
$render_block = function () {
#!/bin/bash
DATE=`date +%Y-%m-%d_%H-%M-%S`
cd "/vagrant/backups/"
mkdir $DATE && cd $_
for i in `mysql -u root -psecret -e "show databases;" | grep -Ev "^(Database|mysql|performance_schema|information_schema)$"`; do
echo "dumping ${i}"
sudo mysqldump -c -u root -psecret ${i} > ${i}.sql
done
@BinaryKitten
BinaryKitten / keybase.md
Created November 19, 2016 02:06
keybase.md

Keybase proof

I hereby claim:

  • I am binarykitten on github.
  • I am binarykitten (https://keybase.io/binarykitten) on keybase.
  • I have a public key whose fingerprint is F32C 7885 D1CB 717E 7CDE 551C 6F04 A8F2 6426 1A15

To claim this, I am signing this object:

<?php
$form_object = get_sub_field( 'form' );
if ( false !== $form_object ) {
gravity_form_enqueue_scripts( $form_object['id'], true );
gravity_form( $form_object['id'], true, true, false, '', true, 1 );
}
?>
function homestead()
{
if [ -z "$1" ]
then
args="status"
else
args="$@"
fi
VAGRANT_CWD=/d/HTDOCS/Homestead/ vagrant $args