Skip to content

Instantly share code, notes, and snippets.

@omarrr
omarrr / addAppToPage.js
Created March 25, 2014 18:43
Bookmarklet: Add Facebook App to Facebook Page
/*
Bookmarklet Ready Code:
javascript:(function(){var h=document.location.href;var regex=/http(s?)\:\/\/developers\.facebook\.com\/x\/apps\/(\w*)/;var appid=h.match(regex)[2];var u='https://www.facebook.com/dialog/pagetab?redirect_uri=http://www.facebook.com/&app_id='+appid;window.location.href=u;})();
*/
var h = document.location.href;
var regex = /http(s?)\:\/\/developers\.facebook\.com\/x\/apps\/(\w*)/;
var appid = h.match(regex)[2];
@omarrr
omarrr / Backtick_Delicious.md
Last active April 12, 2016 06:55 — forked from JoelBesada/README.md
'Delicious' command for Backtick.

Delicious command for Backtick

'Delicious' command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

@omarrr
omarrr / Backtick_Tumblr.md
Last active December 30, 2015 08:29 — forked from JoelBesada/README.md
'Tumblr' command for Backtick

Tumblr command for Backtick

Tumblr command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

@omarrr
omarrr / git101.md
Last active December 26, 2015 04:38
GIT cheatsheet

GIT 101

Concepts

Git States

  • Committed: Data is safely stored in your local db
  • Modified: Data changed but not committed to db yet
  • Staged: Changed data marked to go in next commit snapshot
@omarrr
omarrr / makeContentEditable.js
Last active May 8, 2024 03:58
⌫ Bookmarklet: Edit the web
/*
Bookmarklet Ready Code:
javascript:(function()%7Bdocument.body.spellcheck%3Dfalse%3Bif(!document.getElementById(%22__editing__%22))%7Bvar%20__editing__div%3Ddocument.createElement('div')%3B__editing__div.setAttribute('style'%2C%20'width%3A100%25%3B%20height%3A10px%3B%20background%3A%20red%3B%20position%3A%20fixed%3B%20top%3A%200px%3B%20left%3A%200px%3B%20z-index%3A%201000000%3B')%3B__editing__div.setAttribute('id'%2C%20'__editing__')%3Bvar%20__body%3D%20document.getElementsByTagName('body')%5B0%5D%3B__body.appendChild(__editing__div)%3B%7Dif(document.body.contentEditable!%3D'true')%7Bdocument.body.contentEditable%3D'true'%3Bdocument.designMode%3D'on'%3Bdocument.getElementById(%22__editing__%22).style.display%20%3D%20'block'%3B%7Delse%7Bdocument.body.contentEditable%3D'false'%3Bdocument.designMode%3D'off'%3Bdocument.getElementById(%22__editing__%22).style.display%20%3D%20'none'%3B%7D%7D)()
*/
document.body.spellcheck=false;
if(!document.getElementById("__editing__"))
{
@omarrr
omarrr / gist:6662014
Last active April 4, 2016 21:25
Create arrays with Jekyll's Liquid syntax (http://jekyllrb.com/docs/templates/)
{% assign myArray = "1,2,3" | split: "," %}
@omarrr
omarrr / screen-capture-fix.js
Last active December 22, 2015 08:29
Fix for Google Chrome "Screen Capture" extension bug #310 (https://code.google.com/p/chrome-screen-capture/issues/detail?id=310).
function downloadCapture(forceDownload)
{
var canvas = document.getElementById("canvas");
var image = canvas.toDataURL("image/png");
if (forceDownload)
image = image.replace("data:image/png;base64", "data:application/octet-stream;base64");
window.open(image, "_blank");
}
@omarrr
omarrr / parseUri.js
Last active October 10, 2015 19:48
Split any well-formed URI into its parts
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
// via: http://blog.stevenlevithan.com/archives/parseuri
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
@omarrr
omarrr / uninstall-node.sh
Created July 14, 2012 19:11 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js
#!/bin/sh
(( ${#} > 0 )) || {
echo 'DISCLAIMER: USE THIS SCRIPT AT YOUR OWN RISK!'
echo 'THE AUTHOR TAKES NO RESPONSIBILITY FOR THE RESULTS OF THIS SCRIPT.'
echo "Disclaimer aside, this worked for the author, for what that's worth."
echo 'Press Control-C to quit now.'
read
echo 'Re-running the script with sudo.'
echo 'You may be prompted for a password.'
sudo ${0} sudo