Skip to content

Instantly share code, notes, and snippets.

View sindresorhus's full-sized avatar
🌴
On vacation

Sindre Sorhus sindresorhus

🌴
On vacation
View GitHub Profile
@sindresorhus
sindresorhus / template.user.js
Last active August 21, 2022 18:32
Userscript template
// ==UserScript==
// @name Script name
// @description Description
// @namespace https://yourwebsite.com
// @version 0.1.0
// @author Your name
// @license MIT
// @released 2016-10-18
// @updated 2016-10-18
// @match *://example.com/*
@sindresorhus
sindresorhus / jsonp-usage.js
Created February 24, 2012 12:38
JSONP function - Easily fetch remote JSONP files
// Example usage: Fetch it's own code from GitHub
JSONP( 'https://api.github.com/gists/1900694?callback=?', function( response ) {
console.log( 'JSONP function:', response.data.files['jsonp.js'].content );
});
@sindresorhus
sindresorhus / treewalker-performance.md
Created March 6, 2012 23:22
TreeWalker performance

Test the performance of TreeWalker compared to other DOM walker methods. Ran each test 1000 times. Try it yourself.

Chrome 17

Method                  Total ms    Average ms
document.TreeWalker     911         0.911
Iterative Traverser     2945        2.945
@sindresorhus
sindresorhus / LICENSE.txt
Created March 7, 2012 13:34 — forked from 140bytes/LICENSE.txt
stripScripts - Strip script tags from an HTML string (140byt.es)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sindresorhus
sindresorhus / git-pulley.sh
Created May 7, 2012 20:01
Git merge squash author commit and push - cheatsheet
git checkout master
git checkout -b bug123
git pull http://repourl.git branch
git log | grep "Author" | head -1 # get the author
git checkout master
git merge --squash bug123
git commit -a --author="Author" --message="Close #1: Title. Fixes #666"
git push origin master
@sindresorhus
sindresorhus / LICENSE.txt
Created May 14, 2012 10:35 — forked from 140bytes/LICENSE.txt
View source - view the generated source of a page (140byt.es)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sindresorhus
sindresorhus / LICENSE.txt
Created June 4, 2012 12:14 — forked from 140bytes/LICENSE.txt
Photo Booth (140byt.es)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sindresorhus
sindresorhus / markdown-preview-mou.md
Created June 5, 2012 07:34
How to write your Markdown in Sublime Text 2 and preview in Mou

How to write your Markdown in Sublime Text 2 and preview in Mou

I use Sublime for everything text related, but it doesn't have any built-in way to preview my Markdown files.

This is how easy it is to preview in Mou:

  • In Sublime, go to Tools -> Build System -> New Build System...
  • In the newly opened file, replace the file contents with this and save: { "osx": {
@sindresorhus
sindresorhus / jshint-options.md
Created July 31, 2012 14:43
JSHint options

My recommended JSHint options

JavaScript:

{
	node: true,
	browser: true,
	es5: true,
	esnext: true,
@sindresorhus
sindresorhus / blur-prank.user.js
Last active January 4, 2023 10:33
Blur prank UserScript
// ==UserScript==
// @name Dictionary
// @version 0.1
// @author Sindre Sorhus
// @include *
// ==/UserScript==
document.documentElement.style.webkitFilter='blur(0.5px)';