Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
¯\_(ツ)_/¯

Chris Ruppel rupl

💭
¯\_(ツ)_/¯
View GitHub Profile
@cafuego
cafuego / 2842739-14.patch
Created August 17, 2018 08:46
PWA module 404 fix
View 2842739-14.patch
diff --git a/pwa.module b/pwa.module
index a87172b..fe22fe9 100644
--- a/pwa.module
+++ b/pwa.module
@@ -27,7 +27,7 @@ function pwa_permission() {
function pwa_menu() {
$items = [];
- $items['pwa/serviceworker.js'] = [
+ $items['pwa/serviceworker/js'] = [
@Tomassito
Tomassito / download-file.js
Last active March 11, 2022 23:53 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
View download-file.js
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
link.click();
@colestrode
colestrode / audit.sh
Last active May 20, 2018 20:30
Lint on commit, audit on push
View audit.sh
#!/bin/bash
# This will automatically run npm audit fix on your branch and commit the changes with a commit message that includes the current branch name
# It will not run on develop or master branches
# You can skip it on other branches with the --no-verify command line option: git push origin branch --no-verify
BRANCH=`git rev-parse --abbrev-ref HEAD`
MESSAGE="$BRANCH npm audit fix"
if [[ $BRANCH = 'master' ]] || [[ $BRANCH = 'develop' ]] ; then
echo 'skipping audit on '$BRANCH' branch'
exit 0
@paulirish
paulirish / what-forces-layout.md
Last active April 2, 2023 06:19
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@rickycodes
rickycodes / shrug.sh
Last active November 23, 2015 17:45
View shrug.sh
idk() {
local shrugs=("¯\_(ツ)_/¯" "¯\(°_°)/¯" "¯\(°_o)/¯" "┐(°_°)┌")
local shrug=${shrugs[$RANDOM % ${#shrugs[@]}]}
pbcopy <<< "${shrug}" && echo "${shrug} copied to clipboard"
}
alias shrug=idk
@jbrooksuk
jbrooksuk / markdown.css
Created April 10, 2015 16:36 — forked from imjasonh/markdown.css
Ordered list
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@paulirish
paulirish / bling.js
Last active March 30, 2023 10:40
bling dot js
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@jasonbellamy
jasonbellamy / modal-with-outline-overlay.css
Created February 26, 2015 22:52
Modal overlay created using CSS outline property.
View modal-with-outline-overlay.css
.modal {
background: black;
color: rgb(255, 255, 255);
height: 200px;
left: 50%;
position: relative;
text-align: center;
top: 50%;
transform: translate(-50%, 50%);
width: 200px;
@budparr
budparr / jekyll-collections-prev-next.html
Last active September 29, 2021 10:55
Previous Next Links for Jekyll Collections
View jekyll-collections-prev-next.html
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if links.title == page.title %}
{% unless forloop.first %}
{% assign prevurl = prev.url %}
{% endunless %}
@jonathantneal
jonathantneal / README.md
Last active April 14, 2022 08:26
Local SSL websites on macOS Sierra
View README.md

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"