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
| $form['test_button'] = [ | |
| '#type' => 'submit', | |
| '#value' => $this->t('Save'), | |
| '#ajax' => [ | |
| 'callback' => 'mymodule_ajax_callback', | |
| 'progress' => [ | |
| 'type' => 'mycustomspinner', | |
| 'message' => 'My custom message', | |
| ], | |
| 'wrapper' => 'js_ajax_test_form_wrapper', |
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
| log_format upstream_logging '[$time_local] $remote_addr - $remote_user - $server_name | to: $request | Reuest Time: $request_time | status: $status | Request Body: $request_body'; | |
| server { | |
| access_log /var/log/nginx/website.com_access.log upstream_logging; | |
| error_log /var/log/nginx/website.com_error.log; | |
| } |
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/sh | |
| ## A useful snippet for deploy on Fridays | |
| set -e | |
| DAYOFWEEK=$(date +"%u") | |
| if [ "$DAYOFWEEK" -eq 5 ]; then | |
| echo "┐┌┐┌┐┐┌┐┌┐"; |
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
| ## General settings | |
| Host * | |
| ServerAliveInterval 120 | |
| ## Settings from personal accounts | |
| Host github.com | |
| HostName github.com | |
| IdentityFile ~/.ssh/id_rsa_github | |
| User git |
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
| // Removes all keys under a specific cache key. To use it, replace the "yourcacheprefix" string with the cache prefix used on your app. | |
| redis-cli KEYS "yourcacheprefix:*" | xargs --delim='\n' redis-cli DEL |
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
| function getMachineName(text) { | |
| return text.toLowerCase().replace(/\W/g, '-'); | |
| } |
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
| #include <iostream> | |
| #include <cstdio> | |
| using namespace std; | |
| int main() | |
| { | |
| int daysPerMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | |
| bool leapYear = false; | |
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
| /** | |
| * Implements hook_form_alter(). | |
| */ | |
| function my_module_form_alter(&$form, &$form_state, $form_id) { | |
| /** | |
| * We give a special treatment to all custom forms. | |
| */ | |
| if (substr($form_id, 0, 4) === 'my_module') { | |
| array_unshift($form['#validate'],'my_module_trim_form_values'); |
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
| # Flush memcache on [site domain] domain | |
| drush ev "dmemcache_flush()" --uri="[site domain]" | |
| # Flush varnish cache on [site domain] domain | |
| drush ev "_varnish_terminal_run(array('ban req.http.host ~ [site domain]'))"; | |
| # Truncates all cache tables with SQL queries | |
| echo "SHOW TABLES LIKE 'cache%'" | $(drush sql-connect) | tail -n +2 | xargs -L1 -I% echo "DELETE FROM %;" | $(drush sql-connect) -v |
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
| For V3 | |
| ## Look at an incoming client request of a specific URL: | |
| varnishlog -c -m RxURL:"webiste.com/misite.html" | |
| ##Look at a a backend request of a specific URL: | |
| varnishlog -b -m TxURL:"webiste.com/misite.html" | |
| ## See requests for one specific Hostname: | |
| varnishlog -c -m RxHeader:"Host: webiste.com" |
NewerOlder