Skip to content

Instantly share code, notes, and snippets.

View bohman's full-sized avatar

Linus Bohman bohman

View GitHub Profile
@bohman
bohman / nginx-conf.md
Last active November 30, 2018 08:58
Valet 502 bad gateway - upstream sent too big header

Valet is awesome, but I got seemingly random 502 bad gateway issues on larger sites. After looking in the logs (~/.config/valet/Log) I discovered the error was upstream sent too big header. Googling led me to laravel/valet#290 where the following solution fixed it:

  1. Create ~/.config/valet/Nginx/all.conf with this:
proxy_buffer_size   4096k;
proxy_buffers   128 4096k;
proxy_busy_buffers_size   4096k;
  1. Append this to /usr/local/etc/nginx/fastcgi_params
@bohman
bohman / columns.scss
Last active March 17, 2021 14:03
Simple flexbox columns with css variables. There are a few gotchas since we ensure alignment with negative margin-bottom and margin-left instead of nth-child, but all in all it works pretty well.
[class*=columns-] {
--columns: 2;
--columns-gutter: 40px;
--columns-width: calc(100% / var(--columns) - var(--columns-gutter));
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: stretch;
margin-bottom: calc(var(--columns-gutter) * -1);
@bohman
bohman / placeholder.css
Created January 8, 2016 13:15
Quick example of what a placeholder class might look like when wireframing a site
.placeholder {
background-color: #222;
padding: 80px 0;
text-align: center;
color: rgba(255, 255, 255, .4);
font-weight: bold;
text-transform: uppercase;
}
.placeholder:after {
@bohman
bohman / ga-events.js
Last active April 6, 2020 16:10
Quick and dirty way to collect GA-events in one file. No, doesn't need jQuery. I'm just lazy at the moment.
(function ($) {
window.sw_ga = {};
//
// Events
//
sw_ga.events = [
// Menu toggle
@bohman
bohman / .gitignore_global
Created December 5, 2014 12:33
My global gitignore. Kept here for reference.
# Compiled source #
###################
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
@bohman
bohman / css.css
Created November 3, 2014 07:13
When SASS becomes a sledgehammer for a nail
/* This is a shorter way to do it with css */
[class*="btn"] {
min-width: 100px;
padding: 1em;
border-radius: 1em;
}
.btn--twitter {
color: #fff;
background: #55acee;
}
@bohman
bohman / hashes.js
Last active March 10, 2016 10:53
For those times when you need to imitate query parameters with hashes
/**
*
* When you need to use the hash to imitate query parameters,
* like so:
*
* http://whatever.man/#key=value&another_key=another_value
*
**/
// Set URL to a specific hash. It overrides any existing hash.
input[data-onoff]:empty {
margin-left: -9999px;
}
input[data-onoff]:empty ~ label {
position: relative;
float: left;
height: 22px;
line-height: 22px;
text-indent: 50px;
@bohman
bohman / gist:9526448
Last active August 29, 2015 13:57
example on how to modify queries with filters in wordpress
//---------------------------------
// Modify these taxonomy pages to show all posts
// and sort them alphabetically
//---------------------------------
add_filter('posts_orderby', 'mashcat_alphabetical');
add_filter('post_limits', 'mashcat_limits');
function mashcat_alphabetical($orderby) {
if(!is_admin() && (is_tax('foreign-apis') || is_tax('api-tags') || is_tax('mashup-tags'))) {
@bohman
bohman / responsiveeasteregg.css
Last active December 13, 2015 22:49
Small responsive easter egg. Do with it as you wish.
/*
This is pretty much the smallest you can make the firefox screen without programmatically setting the width.
Chrome and Safari prevents you from going below 400px. An iPhone is 320px, and the smallest Android about 240px IIRC.
The site is pretty much useless like this, so... have an egg.
*/
@media only screen and (max-width: 92px) {
body * {
display: none;
}