This file contains 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\Some\Path; | |
class ShortTermMemory | |
{ | |
private $store = []; | |
public function set($key, $value) | |
{ |
This file contains 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
export function bemify(block, modifiers) { | |
if (!modifiers) { | |
return block; | |
} | |
if (typeof modifiers == 'object' && !Array.isArray(modifiers)) { | |
modifiers = Object.keys(modifiers).filter(modifier => modifiers[modifier]) | |
} | |
if (typeof modifiers == 'string') { |
This file contains 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
export function bemify(block, modifiers) { | |
return block + ' ' + modifiersToArray(modifiers) | |
.map(modifier => `${block}--${modifier}`) | |
.join(' '); | |
} | |
function modifiersToArray(modifiers) { | |
if (!modifiers) { | |
return [] | |
} |
This file contains 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
// ==UserScript== | |
// @name Bet365 reality checker | |
// @version 0.1 | |
// @namespace joelhinz | |
// @description Automatically click on "Förbli inloggad" | |
// @author Joel | |
// @include https://members.bet365.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains 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 | |
/** | |
* Render the view partial for the side component. | |
* | |
* @return string | |
*/ | |
public function renderView() | |
{ | |
$data = [ |
This file contains 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 | |
foreach ($this->lines as $line) { | |
if (!str_contains($line, ':')) { | |
$this->addError($line, 'No code found'); | |
} else { | |
$this->convertLine($line); | |
} | |
} |
This file contains 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 (event) { | |
event.preventDefault(); | |
const activate = document.getElementById(this.dataset.activate); | |
const deactivate = document.getElementById(this.dataset.deactivate); | |
deactivate.classList.add('inactive'); | |
deactivate.classList.remove('active'); | |
setTimeout(() => { |
This file contains 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 | |
// variables | |
$foo = 'bar'; | |
$megafoo = 2345; | |
$superfoo = new AmaziClass(); | |
// class properties | |
class Lingon | |
{ |
This file contains 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 | |
$countries->map(function ($country) { | |
return $country->capital; | |
})->reject(function ($capital) { | |
return $capital->isTiny(); | |
})->partition(function ($capital) { | |
return $capital->hasMayor(); | |
}); |
This file contains 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 | |
// vanliga arrayer | |
$capitals = []; | |
foreach ($countries as $country) { | |
$capitals[] = $country->capital; | |
} | |
// collections | |
$capitals = $countries->map(function ($country) { |
NewerOlder