Skip to content

Instantly share code, notes, and snippets.

@brschwar
brschwar / README.md
Created April 12, 2018 21:16 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@brschwar
brschwar / performance-topics.md
Last active December 7, 2017 16:29
Website Performance Topics
@brschwar
brschwar / gist:99637ae84d2e14d42e9ca99452c245e3
Created December 6, 2017 16:31 — forked from wayspurrchen/gist:b6fd4eb085edf54406b7
Web Performance Optimization Techniques
@brschwar
brschwar / add_apache_brew.md
Created May 9, 2017 21:48 — forked from vitorbritto/add_apache_brew.md
Install Apache with Homebrew

Install Apache with Homebrew

Installing Apache

# Start by stopping the built-in Apache, if it's running, and prevent it from starting on boot.
# This is one of very few times you'll need to use sudo:
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

# We need to tap homebrew-dupes because "homebrew-apache/httpd22" relies on "homebrew-dupes/zlib"

and install Apache 2.2 with the event MPM, and we'll use Homebrew's OpenSSL library

@brschwar
brschwar / tmux-cheatsheet.markdown
Created February 23, 2017 16:04 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<title>Hello, AMPs</title>
<link rel="canonical" href="http://example.ampproject.org/article-metadata.html" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{
@brschwar
brschwar / display-image-sizes.js
Created January 19, 2016 14:52
JavaScript to replace images with placeholders and display their height and width in a div layered on top.
(function(){
jQuery("img").each(function() {
var h, w, x, y, m, i;
h = this.height;
w = this.width;
l = Math.ceil(jQuery(this).offset().left) + 5;
t = Math.ceil(jQuery(this).offset().top);
jQuery('section').css('position', 'relative');
@brschwar
brschwar / .gitconfig
Created December 9, 2015 03:25 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@brschwar
brschwar / detecting-updated-data-attribute.js
Created December 2, 2015 00:03
Detect when an element's attribute value has changed (like mutation observer): example for 'data-select-content-val' that is updated with information dynamically.
$(function() {
// Here you register for the event and do whatever you need to do.
$(document).on('data-attribute-changed', function() {
var data = $('#contains-data').data('mydata');
alert('Data changed to: ' + data);
});
$('#button').click(function() {
$('#contains-data').data('mydata', 'foo');
// Whenever you change the attribute you will user the .trigger
@brschwar
brschwar / TimerFeature.js
Last active November 12, 2015 15:20
"Timer" Feature to Optimize Your Code: Determine how long an operation takes by using "timer" feature to log the results.
function TimeTracker(){
console.time("MyTimer");
for(x=5000; x > 0; x--){}
console.timeEnd("MyTimer");
}