Skip to content

Instantly share code, notes, and snippets.

View pehbehbeh's full-sized avatar

Phil-Bastian Berndt pehbehbeh

View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 2, 2024 03:13
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jasny
jasny / linkify.php
Last active October 21, 2023 16:28
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @return string
*/
public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array())
@robnyman
robnyman / arraybuffer-blob-filereader-localStorage.js
Last active January 30, 2024 09:22
Get file as an arraybuffer, create blob, read through FileReader and save in localStorage
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob
var rhinoStorage = localStorage.getItem("rhino"),
rhino = document.getElementById("rhino");
if (rhinoStorage) {
// Reuse existing Data URL from localStorage
rhino.setAttribute("src", rhinoStorage);
}
else {
// Create XHR, Blob and FileReader objects
var xhr = new XMLHttpRequest(),
@robnyman
robnyman / localStorage-canvas-data-url.js
Created February 21, 2012 08:39
Use localStorage and canvas to same image as a Data URL
// localStorage with image
var storageFiles = JSON.parse(localStorage.getItem("storageFiles")) || {},
elephant = document.getElementById("elephant"),
storageFilesDate = storageFiles.date,
date = new Date(),
todaysDate = (date.getMonth() + 1).toString() + date.getDate().toString();
// Compare date and create localStorage if it's not existing/too old
if (typeof storageFilesDate === "undefined" || storageFilesDate < todaysDate) {
// Take action when the image has loaded
@robnyman
robnyman / image-data-url-localStorage.js
Created February 21, 2012 08:29
Turn image into Data URL and save in localStorage
// Get a reference to the image element
var elephant = document.getElementById("elephant");
// Take action when the image has loaded
elephant.addEventListener("load", function () {
var imgCanvas = document.createElement("canvas"),
imgContext = imgCanvas.getContext("2d");
// Make sure canvas is as big as the picture
imgCanvas.width = elephant.width;
@robnyman
robnyman / json-localstorage.js
Created February 21, 2012 08:14
JSON and localStorage
var cast = {
"Adm. Adama" : "Edward James Olmos",
"President Roslin" : "Mary McDonnell",
"Captain Adama" : "Jamie Bamber",
"Gaius Baltar" : "James Callis",
"Number Six" : "Tricia Helfer",
"Kara Thrace" : " Katee Sackhoff"
};
// Stores the JavaScript object as a string
@sergejmueller
sergejmueller / gist:1766524
Created February 8, 2012 07:36
Tooltip in Form einer Sprechblase auf CSS-Basis
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
.tooltip {
font: normal 11px/17px sans-serif;
color: red;
@warthurton
warthurton / myip
Created August 4, 2011 19:40
TextExpander Local IP
#!/bin/bash
active_interface=`netstat -rn | grep 'default' | awk '{print $6}'`
ifconfig | grep -A 1 $active_interface | grep 'inet ' | awk '{printf $2}'