import $$ from '$$'
$$('p').forEach(a => a.innerText = "yolo")
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
// Reduce a list by cancelling pairs of values. | |
// e.g. cancelByPair('LLLRLRLRLR', 'L', 'R') === 'LL' | |
function cancelByPair(list, firstValue, secondValue) { | |
// First filter out all of these values, and count them as we go. | |
let count = 0; | |
const cancelledList = list.filter(c => { | |
switch (c) { | |
case firstValue: | |
count++ |
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
#!/usr/bin/env php | |
<?php | |
include_once('autoload.php'); | |
ini_set("memory_limit", "-1"); | |
ini_set("date.timezone", "Europe/London"); | |
$cli =& eZCLI::instance(); | |
$script =& eZScript::instance(); | |
$script->startup(); |
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 // Why does syntax highlighting need this? | |
use eZ\Publish\Core\MVC\Symfony\Security\User as EzUser; | |
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Session\Session; | |
$securityContext = $container->get('security.context'); | |
$router = $container->get('router'); | |
$requestStack = $container->get('request_stack'); |
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
#!/bin/bash | |
# | |
# Replaces an entire directory of symlinked files with their originals. | |
# | |
find -L $1 -xtype l -exec bash -c 'cp --remove-destination "$(readlink -f "{}")" "{}"' \; |
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
SET @key = 'test123456789'; | |
SET @username = 'admin'; | |
SET @del = '\n'; | |
SET @hash = MD5(CONCAT(@username,@del,@key)); | |
UPDATE ezuser SET password_hash=@hash WHERE login=@username; |
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
const SITEMAP_CACHE_KEY = 'sitemap-cached-pages-v1' | |
self.addEventListener('install', event => { | |
event.waitUntil(cacheSitemap()) | |
}) | |
const cacheSitemap = _ => caches.open(SITEMAP_CACHE_KEY) | |
.then(cache => | |
cacheSitemap() | |
.then(urls => urls.map(u => u.toString())) |
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 declare(strict_types=1); | |
namespace AppBundle\EventListener; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpKernel\Event\{GetResponseEvent, FilterResponseEvent}; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
use Symfony\Component\HttpFoundation\HeaderBag; | |
class SpecialistPreflightLegacyHandler implements EventSubscriberInterface |
In short, an auto-clicker for cookie-clicker.
This is bookmarklet friendly! You can drag & drop the following link into your bookmarks, or alternatively, directly into the game: Bookmarklet
Alternatively copy the below code, and save it as a bookmark.
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
#include "inspircd.h" | |
/** | |
* m_gender_pronouns.cpp | |
* Introduces two new commands, SETGENDER and SETPRONOUN, | |
* allowing a user to specify their gender identity and | |
* preferred gender pronouns. | |
* | |
* Copyright (c) 2017 Alex Wilson <a@ax.gy> | |
* |