Skip to content

Instantly share code, notes, and snippets.

View gunderwonder's full-sized avatar

Øystein Riiser Gundersen gunderwonder

View GitHub Profile
/* For Node.js - resolve a chain of HTTP redirects
Uses getResponse() from http://gist.github.com/399276
Example: resolveHttpRedirects('http://ow.ly/1Kn4j', function(url) { sys.puts(url) });
*/
function resolveHttpRedirects(url, callback, maxnum) {
maxnum = maxnum || 3;
var count = 0;
function next(url) {
getResponse(url, function(response) {
//Accelerometer Javascript example by @karlwestin, Nerd Communications, Berlin
// Firefox, works on desktop too
window.addEventListener("MozOrientation", updateText, true);
// Mobile Safari
window.addEventListener("devicemotion", updateText, true);
function updateText(e) {
anonymous
anonymous / gist:2523336
Created April 29, 2012 02:01
Changing author info
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@algal
algal / websitescreenshot.md
Last active December 26, 2023 11:07
Taking website screenshots, in Chrome or Safari, including simulating iPhones

Taking website screenshots

These are instructions for taking screenshots of an entire webpage, not just the part of the webpage visible in the browser.

Website Screenshots in Safari

This requires Safari 11.3, which comes on macOS 10.3.4.

  1. Open the website in Safari
  2. If needed, go Safari > Preferences > Advanced > Show Develop Menu in Menu Bar