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
#!/bin/bash
# Utility to force your mac immediately into hibernation mode/suspend to disk,
# thus conserving battery considerably (at the cost of slower startup)
# @date 2012-02-10
# @author Carl-Erik Kopseng. Contact at oligofren.wordpress.com
# must be run as root by using sudo or to avoid entering the password, change the pmset
# executable settings by entering
# sudo chmod +s /usr/bin/pmset
@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.

@fatso83
fatso83 / transition-end-feature-detect.js
Created June 20, 2016 17:25
Feature detect the actual transition end event used in the current browser. Needed for some buggy Samsung devices
// globals: window, document, $
//
// Feature detect the actual transitionFinished event
// used by the current browser
//
// Used like this:
// var features = {};
// transitionEndFeatureDetection((eventName) => {
// features.transitionFinishedEvent = eventName;
// });
@fatso83
fatso83 / Full restart of IIS
Created June 21, 2016 12:52
How to fully stop the IIS and the Web Application System to be able to clear caches and stuff
# It should be run with admin rights. Rerun if it fails.
net stop was
# do your thing: run deploy script, whatever
# iis no longer holds on to any files
# to clear the cache of compiled cshtml templates matching "preview" I did this
# `find /cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319/ -iname '*campaign*' -print0|xargs -0 rm`
net start w3svc
@fatso83
fatso83 / test-script.sh
Last active July 28, 2016 21:35
Test script to find the regression mentioned in #1046
#!/bin/bash
# test script built for use with `git bisect` to find a regression
# usage: git bisect start v1.16.1 v1.15.4 && git bisect run ../test-script.sh
# Alternatively run it manually and use `git bisect good/bad`
#
# Warning: You need a Node version <= 0.12.5
# Since this script checks out former versions of Sinon, that had build scripts
# that relied on the directory layout of NPM versions < 3, it is wise to
# use `nvm` or `n` to set the current Node version to 0.12.5 or equivalent
@fatso83
fatso83 / test-script.sh
Last active July 28, 2016 18:43
Test script for sinonjs/sinon#1113. Place it one level above the project and run `sh ../test-script.sh` to test it
#!/bin/bash
# test script built for use with `git bisect` to find a regression
# usage: git bisect start v1.16.1 v1.15.4 && git bisect run ../test-script.sh
#
# Warning: You need a Node version <= 0.12.5
# Since this script checks out former versions of Sinon, that had build scripts
# that relied on the directory layout of NPM versions < 3, it is wise to
# use `nvm` or `n` to set the current Node version to 0.12.5 or equivalent
# To support running this script when it is placed outside of the project
@fatso83
fatso83 / build.rb
Last active July 31, 2016 10:06
Example of automatically adding collections to _config.yml
require "set"
require "pathname"
require "yaml"
docs_folder = "resources/main-project-repo/docs/"
config = YAML.load_file "_config.yml"
version_folders = Pathname.new(docs_folder).children.select do |c|
c.directory?
end
@fatso83
fatso83 / log-lunch.sh
Last active May 18, 2021 00:31
Log your lunch hours in JIRA on the CLI. Install on Mac: `curl https://gist.githubusercontent.com/fatso83/cc014edf3f9877b93914e59887e58eb2/raw/ > tmp.sh; sh tmp.sh --install-mac`
#!/bin/bash
################################################################################
# Lunch logger for lazy Making Waves people.
#
# Integrates with native scheduler on OS X
#
# Usage:
# `log-lunch today # will log lunch for today`
# `log-lunch 2016-08-03 # will log lunch for august 3rd`
#

Keybase proof

I hereby claim:

  • I am fatso83 on github.
  • I am kopseng (https://keybase.io/kopseng) on keybase.
  • I have a public key whose fingerprint is 29B6 E6EB DCC3 CFC9 CACC 8209 572F 9EA0 B3F1 325B

To claim this, I am signing this object:

@fatso83
fatso83 / mail-rfc822-address.pl
Created September 13, 2016 08:43
This is why you don't make a regex email validator
# A backup of the main regex from "Mail::RFC822::Address: regexp-based address validation"
# http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
# Regex made available by Paul Warren, 17/09/2012
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\