Skip to content

Instantly share code, notes, and snippets.

(function() {
console.log('test');
})();
@peterchappell
peterchappell / .block
Last active March 23, 2017 17:02
me bar chart
license: mit
@peterchappell
peterchappell / .block
Last active March 22, 2017 14:15
fresh block
license: mit
@peterchappell
peterchappell / .block
Created March 22, 2017 13:42
fresh block
license: mit
@peterchappell
peterchappell / .block
Created March 22, 2017 13:42
fresh block
license: mit
@peterchappell
peterchappell / LogIt.scpt
Last active August 29, 2015 14:26 — forked from sippey/LogIt.scpt
applescript for use with quicksilver to log text with date and timestamp
using terms from application "Quicksilver"
on process text log_text
set theDate to (do shell script "date '+%A %d-%m-%Y'")
set theTime to (do shell script "date '+%H:%M'")
set theText to log_text
if (log_text is equal to "start") then
set theText to "
---
" & theDate & "
# get version of current kernel
uname -r
# get a list of the stored kernels
dpkg --list | grep linux-image
# remove an old kernel
sudo apt-get purge linux-image-x.x.x.x-generic
# update grub
@peterchappell
peterchappell / updateQueryStringParam.js
Last active August 29, 2015 14:17 — forked from excalq/gist:2961415
JavaScript method for updating a url silently
// Explicitly save/update a url parameter using HTML5's replaceState().
function updateQueryStringParam (param, value) {
var baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
var urlQueryString = document.location.search;
var newParam = param + '=' + value;
var params = '?' + newParam;
// If the "search" string exists, then build params from it
if (urlQueryString) {
var keyRegex = new RegExp('([\?&])' + param + '[^&]*');
<!-- 1: First JavaScript snippet (Hello World Button) -->
<button id="mybutton">Click me</button>
<script>
$(document).ready(function() {
var button = document.getElementById("mybutton");
button.addEventListener("click", function(event) {
alert("Hello World");
});
});
<!-- The HTML Page Stub -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello World</title>
</head>
<body>
<!-- Content goes here -->
</body>