Skip to content

Instantly share code, notes, and snippets.

View carlwiedemann's full-sized avatar

Carl Wiedemann carlwiedemann

View GitHub Profile
@samthor
samthor / safari-nomodule.js
Last active February 14, 2024 02:54
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@zmaril
zmaril / softwarehelpskill.md
Last active August 3, 2021 04:52
I want to write software that helps kill people.

I want to write software that helps kill people.

Please, before you call the police and get my github account put on lockdown, allow me a moment to explain. What I really want to do is work on projects that advance the human condition and improve people's lives. I've been in a mad dash to learn how to program for the past four or five years exactly because I realized how much good I could do for the world with a computer.

@Potherca
Potherca / README.md
Last active June 11, 2021 19:19
Searching for a generic documentation block convention to use with BASH

Documentation block tags conventions for BASH

For most languages a single standard for documenting functions and methods in block comments (a.k.a. doc-blocks) has emerged.

For BASH, however, there does not seem to be a definitive convention. Several competing conventions exist, which made me think:

Could a list of doc-block tags be distilled from those used across all (or most) languages?

Time to find out!

@taylorotwell
taylorotwell / global-homestead.sh
Created September 23, 2015 21:40
Global Homestead Without Composer
alias homestead='function __homestead() { (cd ~/Documents/Code/Homestead && vagrant $*); unset -f __homestead; }; __homestead'
# Usage
homestead up
homestead halt
# etc...
@star-szr
star-szr / xhprof-kit.sh
Last active February 7, 2016 14:16
xhprof-kit aliases and functions
# Creates a baseline from your current branch (should usually be 8.x).
alias bbranch='./xhprof-kit/benchmark-branch.sh `git rev-parse --abbrev-ref HEAD`'
# Using the baseline xhprof identifier from the bbranch command above will benchmark 8.x against the baseline and your patched branch.
# e.g.
# bbranches [XHPROF-IDENTIFIER] [twig-branch-name-here-1234456]
function bbranches() {
originalbranch="$(git rev-parse --abbrev-ref HEAD)"
base=$1
shift
<?php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(function () {
$namespace = 'sitename';
$filename = '/tmp/' . uniqid() . '.' . $namespace . '.xhprof';
file_put_contents($filename, serialize(xhprof_disable()));
});
@lewisnyman
lewisnyman / gist:5651296
Created May 26, 2013 00:22
template_preprocess_html
/**
* Prepares variables for HTML document templates.
*
* Default template: html.html.twig.
*
* @param array $variables
* An associative array containing:
* - page: A render element representing the page.
*
* @see system_elements()
@joelpittet
joelpittet / attributes-count
Created May 25, 2013 16:36
List of all the template files uses of attributes, title_attributes and content_attributes in d8
Drupal 8 Stats as of May 24th, 2013
`title_attributes` used in 12 templates or theme functions.
`content_attributes` used in 9 templates or theme functions and assumed existance in rdf.
`attributes` used in 35 templates or theme functions.
## Title Attributes
```
core/modules/block/templates/block.html.twig:
#!/bin/bash
# Daisydiff script based on https://gist.github.com/c4rl/5385704 for unix users
# Required folder structure:
# - this script
# - daisydiff folder
# - tmp folder
# CONFIGURATION
USERNAME=youruser
@jpstroop
jpstroop / c4l_loris_lightning_talk.md
Last active December 12, 2015 12:19
Lightning talk re: Loris <https://github.com/pulibrary/loris> for code4lib 2013.