Skip to content

Instantly share code, notes, and snippets.

View HeikoMamerow's full-sized avatar

Heiko Mamerow HeikoMamerow

View GitHub Profile
@addyosmani
addyosmani / headless.md
Last active May 1, 2024 03:05
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@lgladdy
lgladdy / grunt-sitemap.php
Created April 13, 2014 14:25
Grunt Sitemap Generator plugin for Wordpress
<?php
/**
* Plugin Name: Grunt Sitemap Generator
* Plugin URI: http://www.github.com/lgladdy
* Description: Generate a JSON list of every page on a site so it can be used with grunt and uncss. Create a folder in /wp-content called mu-plugins, and drop this code into that folder, as grunt-sitemap.php
* Author: Liam Gladdy
* Author URI: http://gladdy.co.uk
* Version: 1.0
*/
@lgladdy
lgladdy / gruntfile
Created May 13, 2014 08:07
This is the gruntfile that powers gladdy.co.uk. It's for the blog post here: http://www.gladdy.co.uk/blog/2014/04/13/using-uncss-and-grunt-uncss-with-wordpress/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'js/app.coffee.js.map'
},
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
@ck-on
ck-on / hhvminfo.php
Last active September 18, 2022 05:44
HHVMinfo - phpinfo for HHVM HipHop Virtual Machine
<?php
/*
HHVMinfo - phpinfo page for HHVM HipHop Virtual Machine
Author: _ck_
License: WTFPL, free for any kind of use or modification, I am not responsible for anything, please share your improvements
Version: 0.0.6
* revision history
0.0.6 2014-08-02 display fix for empty vs zero
0.0.5 2014-07-31 try to determine config file from process command line (may not always work), style improvements
@mjkaufer
mjkaufer / roulette.sh
Created October 24, 2014 00:55
Bash Roulette
alias roulette='[ $[ $RANDOM % 6 ] == 0 ] && rm -f $(shuf -n1 -e *) && echo "BOOM" || echo *Click*'
@inian
inian / brotli-sw.js
Last active February 27, 2024 00:40
Enabling Brotli on CDNs which don't support it yet
// MIT License
// Copyright (c) 2016 Dexecure
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@kasparsd
kasparsd / top-wp.sh
Last active October 21, 2019 18:46
Finding WordPress in Alexa top 1 million sites, see http://crawler.wproll.com
#!/bin/bash
while IFS=',' read -r POS HOSTNAME; do
if cat checked.csv | grep -qxF "$HOSTNAME"; then
echo "Skipping $HOSTNAME, already checked."
continue
fi
# Look for `/wp-content/` in the HTML output
@SKempin
SKempin / Git Subtree basics.md
Last active May 3, 2024 02:57
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this: