Skip to content

Instantly share code, notes, and snippets.

View fatso83's full-sized avatar
🐢
Two toddlers. Very little time for OSS after work hours. File a PR!

Carl-Erik Kopseng fatso83

🐢
Two toddlers. Very little time for OSS after work hours. File a PR!
View GitHub Profile
@oliveratgithub
oliveratgithub / Add Reminder to Wunderlist.scpt
Last active November 13, 2015 16:37
AppleScript to add a Text selection as a new Reminder to Wunderlist
on run {input, parameters}
-- This code comes from http://raduner.ch/blog/
-- To be used with an Automator Service
-- ------------------------------------------------
tell application "System Events"
keystroke "c" using {command down}
end tell
set inputText to the clipboard as Unicode text
@dpo
dpo / mail2things.scpt
Last active December 13, 2015 20:08
An Automator workflow to add an email from Mail.app to Things' Inbox. This is a modification of http://dl.dropbox.com/u/8019/MailToThings.scpt. Create an Automator Service, start with "Get Selected Mail Messages", then "Run AppleScript" and paste the contents of this gist as script. Subsequently, you can process the list of new todo items. I lik…
on run {input, parameters}
set todoList to {}
repeat with theMessage in input
-- Grab message info.
tell application "Mail"
-- Remove apostrophes from Subject as they wreak havoc.
set AppleScript's text item delimiters to {"'"}
@buger
buger / time_tracker.sh
Last active July 26, 2017 21:13
Bash time tracker
active_time() {
# Query display logs
logs=$(/usr/bin/pmset -g log | grep 'Display is turned')
# By default Mac turn off monitor after 15 minutes
timeout=900
# Read logs line by line
# Line format: 2016-07-12 07:50:02 +0300 Notification Display is turned on
echo "$logs" | while IFS= read -r line; do
d=$(echo $line | cut -c 1-19); # extract full date
@fatso83
fatso83 / sinon-issue-usage-question.md
Last active May 1, 2018 15:06
Close message for questions on the Sinon issue tracker

We are trying to keep the GitHub issues list tidy and focused on bugs and feature discussions. This ticket looks like a usage question; please post it to StackOverflow and tag it with sinon, so the bigger community can help answer your questions.

If you feel that your topic is an issue with Sinon, please open a new ticket and follow the guidelines for reporting an issue.

@nivsherf
nivsherf / edit_sinon_docs.sh
Created September 6, 2018 23:15
Sinon Doc Editor
#!/bin/sh
# Usage example: ./edit_sinon_docs.sh stubs 4.1.1
# Will open stubs.md from 4.1.1 for editing and propagate the changes to later versions.
# Make sure you have SINON_HOME pointing to the repository root.
# You'll need git and the npm "semver" package installed (npm i -g semver)
cd $SINON_HOME/docs
FILENAME=$1.md
@scmx
scmx / react-proptype-warnings-as-errors-with-sinon.markdown
Last active March 1, 2019 08:42
Make React PropType warnings throw errors with mocha.js, enzyme.js and sinon.js

Make React PropType warnings throw errors with enzyme.js + sinon.js + mocha.js

A simple stateless functional component that we want to test that it renders without propType warnings.

import React, { PropTypes } from 'react'

let VersionListItem = function ({ active, version }) {
  return (
const SITEMAP_CACHE_KEY = 'sitemap-cached-pages-v1'
self.addEventListener('install', event => {
event.waitUntil(cacheSitemap())
})
const cacheSitemap = _ => caches.open(SITEMAP_CACHE_KEY)
.then(cache =>
cacheSitemap()
.then(urls => urls.map(u => u.toString()))
@zeraphie
zeraphie / !-readme.md
Last active October 16, 2019 11:56
Add a service worker that can read a sitemap

Service Workers with a Sitemap Parser

This is a collection of ES2017 classes (so a transpiler is needed, webpack is used here with babel and the env preset) that utilize Service Workers to add offline support for a site. This example should work for WordPress sites as well

Installation

Because DOMParser is not included in Service Workers, you will need to install the npm package xmldom

npm install xmldom --save-dev

With Service Workers

@derwiki
derwiki / javascript-for-vim-refactoring.js
Created May 29, 2013 15:08
Moving faster with Vim (5-minute lightning talk presentation). I wasn't inspired to learn effective command of Vim until I saw some people flying around faster than I thought was possible. The goal of this presentation is to call out how slow "normal" text editing is, and how many keystrokes can be reduced by using increasingly more terse Vim co…
$(function() {
// good opportunity to combine into a single statement
// qq w cw <esc> A, <esc> 0 j q
var a = 10;
var b = 20;
var c = 30;
var d = 40;
var e = 50;
// opportunity to simplify syntax
@tech-otaku
tech-otaku / macbook.sh
Last active March 24, 2022 11:54
Ubuntu Desktop Configuration on MacBook Pro
#!/usr/bin/env bash
# Note: LOGIN SCREEN SCALE (200%), LOGIN SCREEN SIZE (1152x864) and DISPLAY SCALE (200%) below are dependant on
# Virtual Machine > Settings > Display > 'Use full resolution for Retina display' in VMware Fusion being checked
# (gui.fitGuestUsingNativeDisplayResolution = "TRUE" in .vmx file)
# Get the installed Ubuntu version e.g. 20, 18, 16 etc.
VERSION=$(lsb_release -r | awk '{print $2}' | cut -d '.' -f 1)