Not using versioning on your configuration files and editing them with Vim?
Use Vim’s backup option to automatically keep a copy of past versions. To put in your ~/.vimrc
:
"Turn on backup option
set backup
javascript:(function () { | |
if (!document.getElementById('sun-maxplayer')) { | |
var style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.id = 'sun-maxplayer'; | |
style.appendChild(document.createTextNode(' | |
/* ZDF */ | |
html .page #skip-main .b-playerbox { width: 100vw; z-index: 999999999; transform: translate3d(-341.9px, 0px, 0px); } | |
html .page .scroll-arrow { display: none; } | |
html .b-header { position: static; } |
#!/bin/bash -eux | |
CURRENT_DIR=${PWD} | |
NAME="$(basename $CURRENT_DIR)" | |
DOCROOT=$(drush dd) | |
FILEPATH=$(realpath --relative-to="$DOCROOT" "$CURRENT_DIR") | |
drush potx --api=8 --folder=$FILEPATH/* | |
mkdir -p ./translations | |
mv $DOCROOT/general.pot ./translations/$NAME.pot |
# Replace `define('...', '...');` with `const ... = ...;` | |
:%s/define( *'\(\w*\)',\( *\)'\([^']*\)' *);/const \1 =\2'\3';/ | |
# Replace `isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] :` with `$_SERVER['SERVER_NAME'] ??` | |
# Using different delimiters to match an underscore literally. | |
:%s!isset.*SERVER_NAME.*:!$_SERVER['SERVER_NAME'] ??! | |
# Convert line endings to Linux/Unix | |
:set ff=unix |
wp post list --field=ID --post_type=product | xargs wp post delete --force |
diff --git a/sites/default/settings.php b/sites/default/settings.php | |
index b2ce930..9d0514e 100644 | |
--- a/sites/default/settings.php | |
+++ b/sites/default/settings.php | |
@@ -611,7 +611,8 @@ | |
* The 'bootstrap_config_storage' setting needs to be a callable that returns | |
* core.services.yml. | |
*/ | |
- # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage'); | |
+$settings['bootstrap_config_storage'] = 'Drupal\Core\Config\BootstrapConfigStorageFactory::getFileStorage'; |
alias.ssave=stash save | |
alias.sshow=!f() { git stash show stash^{/$*} -p; }; f | |
alias.sapply=!f() { git stash apply stash^{/$*}; }; f | |
alias.assume=update-index --assume-unchanged | |
alias.unassume=update-index --no-assume-unchanged | |
alias.assumed=!git ls-files -v | grep ^h | cut -c 3- | |
alias.masterdiff=log --oneline --no-merges --reverse master ^HEAD | |
alias.staged=diff --staged | |
alias.amend=commit --amend | |
alias.graph=log --oneline --graph --color=auto |
<?php | |
require './core/vendor/autoload.php'; | |
use Symfony\Component\Yaml\Parser; | |
function quantile($values, $p) { | |
sort($values); | |
$H = (count($values) - 1) * $p + 1; | |
$h = floor($H); | |
$v = $values[$h - 1]; |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
<?php | |
function entity_get_operation_links($entity_type, $entity, $base_path = NULL) { | |
$build = array( | |
'#theme' => 'links__operations__' . $entity_type, | |
'#links' => array(), | |
'#attributes' => array('class' => array('links inline')), | |
); | |
list($entity_id) = entity_extract_ids($entity_type, $entity); |