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 | |
| // You shouldn't call this at runtime - do it when something builds (ex: plugins) and store the args somewhere. | |
| function get_autowire_args(callable $callback, \Drupal\Component\DependencyInjection\Container $container) { | |
| $cache = &drupal_static(__FUNCTION__); | |
| $args = []; | |
| $reflection = new \ReflectionFunction($callback); | |
| foreach ($reflection->getParameters() as $i => $param) { | |
| $type_obj = $param->getType(); | |
| if (!$type_obj || ($type_obj instanceof \ReflectionNamedType && $type_obj->isBuiltin())) { |
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 Some\Namespace\I\Dont\Trust; | |
| function unserialize($data, array $options = []) { | |
| if (empty($options)) { | |
| $options = [ | |
| 'allowed_classes' => [ | |
| \DateTime::class, // Set to classes used in namespace. | |
| ], |
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
| document.querySelectorAll("form").forEach((formEl) => { | |
| const key = location.pathname + formEl.id; | |
| const json = localStorage.getItem(key); | |
| if (json) { | |
| const data = JSON.parse(json); | |
| Object.keys(data).forEach((inputId) => { | |
| formEl.elements[inputId].value = data[inputId]; | |
| }); | |
| } else { | |
| localStorage.setItem( |
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
| document.body.innerHTML = 'get back to work' |
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
| package main | |
| import ( | |
| "context" | |
| "database/sql" | |
| "flag" | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| "strings" |
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
| #! /bin/bash | |
| # RENDER_SERVICE_NAMES should be a newline-separated list of service IDs (ex: srv-...) | |
| # RENDER_API_TOKEN is your personal Render API token | |
| max_attempts=200 | |
| while IFS= read -r RENDER_SERVICE_NAME; do | |
| echo "Checking $RENDER_SERVICE_NAME ..." | |
| attempt_counter=0 |
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
| #! /bin/bash | |
| # Assumes migrations are stored in ./db/migrations as single files. | |
| # Also assumes migrations are in (alphanumeric) order. | |
| set -e | |
| rm -rf /tmp/test-migrations | |
| mkdir /tmp/test-migrations | |
| cp -r db/migrations/* /tmp/test-migrations/ |
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
| { | |
| "manifest_version": 3, | |
| "name": "count daily youtube watch time", | |
| "description": "made by sam", | |
| "version": "0.0.1", | |
| "content_scripts": [ | |
| { | |
| "matches": [ | |
| "https://www.youtube.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
| # spotify_focuser.applescript | |
| # An AppleScript script that decreases Spotify volume while you're not using work related apps and websites. | |
| # by Samuel Mortenson | |
| # To install, download this script and open it in Script Editor, then select File > Export and export the script as an Application with "Stay open after run handler" checked. Now you can run the exported Application and GET BACK TO WORK! | |
| # You shouldn't normally run random AppleScript or give it permissions, so uh read the code first before doing something dumb. | |
| # Other notes: | |
| # - Volume is only changed when a song is playing | |
| # - Volume does not change while Spotify is open, to stay neutral about whether or not that is work related |
OlderNewer