Skip to content

Instantly share code, notes, and snippets.

@gonzalo123
gonzalo123 / gist:868939
Created March 14, 2011 09:31
push existing repository to github
cd existing_git_repo
git remote add origin git@github.com:[user]/[reponame].git
git push -u origin master
@rentzsch
rentzsch / gist:1047967
Created June 26, 2011 20:56
Close a Chrome Tab using AppleScript
tell application "Google Chrome"
set windowList to every tab of every window whose URL starts with "https://mail.google.com"
repeat with tabList in windowList
set tabList to tabList as any
repeat with tabItr in tabList
set tabItr to tabItr as any
delete tabItr
end repeat
end repeat
end tell
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@matiaskorhonen
matiaskorhonen / gist:3013808
Created June 28, 2012 20:44
Chrome for iOS user-agents

Chrome for iOS user-agents

iPhone

Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-gb)
AppleWebKit/534.46.0 (KHTML, like Gecko)
CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3

@jasonfarrell
jasonfarrell / usage.js
Last active February 23, 2021 22:15
Checks if a DOM element is visible. Takes into consideration its parents and overflow.
var my_element = document.getElementById('my-element');
//-- Returns true/false
my_element.isVisible(my_element);
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 11, 2024 07:57
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@kristopherjohnson
kristopherjohnson / formatjson.js
Last active November 29, 2023 02:47
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var stdin = process.stdin,
stdout = process.stdout,
inputChunks = [];
stdin.resume();
@impressiver
impressiver / raven-config.html
Last active February 27, 2024 14:27
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@Pushplaybang
Pushplaybang / rgb_to_hex_to_rgb.php
Created April 22, 2013 06:35
php functions convert hex to rgb and rgb to hex
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
@kendellfab
kendellfab / goto-sublime
Created August 1, 2013 20:53
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",