Skip to content

Instantly share code, notes, and snippets.

@cobyism
cobyism / gh-pages-deploy.md
Last active Sep 16, 2021
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).
View gh-pages-deploy.md

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@tbranyen
tbranyen / backbone_pushstate_router.js
Last active Jul 11, 2021
hijack links for pushState in Backbone
View backbone_pushstate_router.js
// All navigation that is relative should be passed through the navigate
// method, to be processed by the router. If the link has a `data-bypass`
// attribute, bypass the delegation completely.
$(document).on("click", "a[href]:not([data-bypass])", function(evt) {
// Get the absolute anchor href.
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
// Get the absolute root.
var root = location.protocol + "//" + location.host + Application.root;
// Ensure the root is part of the anchor href, meaning it's relative.
@epintos
epintos / mediumStoriesStats.js
Last active Mar 8, 2021
Export Medium Stats Stores to CSV
View mediumStoriesStats.js
// Run Inspector Console in chrome and copy and paste the following code in the /stats/stories view
function download(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
@poshaughnessy
poshaughnessy / samsung-internet-versions-rough-guide.md
Last active Oct 5, 2020
Rough browser version guide for Samsung Internet
View samsung-internet-versions-rough-guide.md

v1.x (v1.0: Chromium 18, v1.5 & v1.6: Chromium 28)

v1 logo

Originally based on the stock Android browser (AOSP), 2012.

"It was around early 2013 when we made [the decision to move to Chromium]. We shipped our first Chromium-based browser in one of the Galaxy S4 models released later in 2013." (Source)

  • v1.0 preloaded in Galaxy S4
  • v1.5 preloaded in Galaxy Note 3
@bryik
bryik / .block
Last active Dec 4, 2019
Anisotropic Filtering With and Without
View .block
license: mit
@brownsmith
brownsmith / blatdocker.sh
Created May 31, 2018
Delete all docker images
View blatdocker.sh
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@epintos
epintos / mediumOverviewStats.js
Created Jan 20, 2017
Export Medium Overview Stats to CSV
View mediumOverviewStats.js
// Max value of the Minutes Read Graph
minutesReadMaxAxis = 810
// Max value of the Views Graph
viewsMaxAxis = 431
// Max value of the Visitors Graph
visitorsMaxAxis = 344
// First date of the graph (US Format)
initialDay = new Date('12/22/2016')
// Days in the graphs
@michaelkoper
michaelkoper / backbone_pushstate_router.js
Last active Oct 5, 2016 — forked from tbranyen/backbone_pushstate_router.js
hijack links for pushState in Backbone. With open in new tab functionality.
View backbone_pushstate_router.js
// Use absolute URLs to navigate to anything not in your Router.
var openLinkInTab = false;
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
$(document).keydown(function(event) {
if (event.ctrlKey || event.keyCode === 91) {
openLinkInTab = true;