Skip to content

Instantly share code, notes, and snippets.

@nothinking
nothinking / git-tag-delete-local-and-remote.sh
Created March 21, 2019 08:09 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
/* github wide */
.container { width:auto !important}
.repository-with-sidebar .repository-sidebar {position: fixed; right:0;bottom:0;background:#fff;z-index:100;}
.repository-with-sidebar .repository-content {float:none; margin-right:100px;}
.discussion-timeline {float:none;width:auto;margin-right:160px}
.discussion-sidebar {position:fixed;right:50px;bottom:0;top:auto;z-index:100;background:#fff}
.repository-with-sidebar.with-full-navigation .repository-content {width:auto;margin-right:190px}
.repository-with-sidebar .repository-content {width:auto}
@nothinking
nothinking / gist:ef2d6532df9a61030ee7
Last active August 29, 2015 14:21
moment-weekofmonth.js
moment.fn.weekOfMonthFormat = function(format) {
var formats = format.split("-");
return moment(formats[0] + "-" + formats[1], "YYYY-MM").weekOfMonth(formats[2]);
}
moment.fn.koDay = function() {
var day = this.clone().day() || 7;
return --day;
}
moment.fn.weekOfMonth = function(input) {
var day = this.clone().date(1).koDay();

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

worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
#!/bin/sh
export DEVELOPER_DIR="/Applications/XCode.app/Contents/Developer"
SYMBOLICATECRASH=`find /Applications/Xcode.app -name symbolicatecrash -type f`
${SYMBOLICATECRASH} -v "$1"
@nothinking
nothinking / Prefix.pch
Created October 28, 2013 04:51
iOS Macro
// define UIColor macro
#define UIColorRGBMake(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
// iOS version check macro
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@nothinking
nothinking / jquery.textareaAutoResize.js
Created June 12, 2013 01:28
javascript: jquery.textareaAutoResize.js
/**
* This jQuery plugin resizes a textarea to adapt it automatically to the content.
* @author Amaury Carrade
* @version 1.1
*
* @example $('textarea').autoResize({
* animate: { // @see .animate()
* enabled: true, // Default: false
* duration: 'fast', // Default: 100
* complete: function() {}, // Default: null
// Given a query string "?to=email&why=because&first=John&Last=smith"
// getUrlVar("to") will return "email"
// getUrlVar("last") will return "smith"
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/
function getUrlVar(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
}

gist.io test