Skip to content

Instantly share code, notes, and snippets.

<a href="http://www.facebook.com/sharer.php?u=[URL-TO-SHARE]">Share on Facebook</a>
<a href="http://twitter.com/share?text=[TEXT]&url=[URL-TO-SHARE]">Tweet</a>
<a href="https://plus.google.com/share?url=[URL-TO-SHARE]">Google+ share</a>
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@oguzhanaslan
oguzhanaslan / uri.js
Last active August 29, 2015 14:20 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
(function(global) {
function Dither(container, width, height) {
this.container = container;
this.width = width;
this.height = height;
this.canvas = null;
this.image = null;
this.draw = this.draw.bind(this);
@oguzhanaslan
oguzhanaslan / fit.js
Last active August 29, 2015 14:20 — forked from KrofDrakula/fit.js
// shorter vars for brevity
var a = image.naturalWidth,
b = image.naturalHeight,
c = maxImageWidth,
d = maxImageHeight,
r1 = a / b, // image aspect ratio
r2 = c / d; // container aspect ratio
// determine which dimension is the limiting factor
// according to the aspect ratio comparison and
@oguzhanaslan
oguzhanaslan / vimrc-front-end
Last active August 29, 2015 14:27 — forked from mrmrs/vimrc-front-end
VIMRC for vim beginners that are Front End Developer types.
set nocompatible
set title
set number " Show line numbers
set history=1000 " Default is 20, I'd rather set this to ∞
set nofoldenable " Don't fold shit
set laststatus=2 " Always show file status line
set encoding=utf-8
setlocal tabstop=4
setlocal shiftwidth=4
@oguzhanaslan
oguzhanaslan / Sharer.md
Last active August 27, 2015 10:13 — forked from Silfen/Sharer.md
Sharer

Twitter

http://twitter.com/share?text={description}&url={url}&hashtags={hashtags}

Facebook

http://www.facebook.com/share.php?u={url}

Pinterest

http://pinterest.com/pin/create/button/?url={url}&media={picture_url}&description={description}

Tumblr

http://www.tumblr.com/share/link?url={url}&amp;name={name}&amp;description={description}

@oguzhanaslan
oguzhanaslan / gist:b46ba6d0d78dca3d6433
Last active September 2, 2015 10:20 — forked from ademilter/gist:8972161
share & share count
// SHARE COUNT
$.getJSON("https://graph.facebook.com/fql?q=SELECT like_count FROM link_stat WHERE url=" + encodeURIComponent('"' + Screenshot.Meta.full_url + '"') + " &callback=?", function(t) {
t.data[0] && $("#share-button-fb .shot-social-count").html(shorterTotal(t.data[0].like_count))
})
$.getJSON("http://cdn.api.twitter.com/1/urls/count.json?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&callback=?", function(t) {
t.count && $("#share-button-twitter .shot-social-count").html(shorterTotal(t.count))
})
@oguzhanaslan
oguzhanaslan / 1-proposal.md
Created June 27, 2016 13:22 — forked from JedWatson/1-proposal.md
Proposal: adding reverse-relationship population to Mongoose (as implemented in KeystoneJS)

I've developed a useful feature in KeystoneJS that lets you populate a relationship from either side, while only storing the data on one side, and am looking for feedback on whether it is something that could / should be brought back into mongoose itself. (It might be possible to add as a separate package but I suspect there'd be too much rewriting of mongoose internals for that to be a good idea).

I've added this as an issue in mongoose for consideration: #1888 but am leaving this gist in place because the examples are easier to read.

I've used Posts and Categories as a basic, contrived example to demonstrate what I'm talking about here; in reality you'd rarely load all the posts for a category but there are other real world cases where it's less unreasonable you'd want to do this, and Posts + Categories is an easy way to demo it.

The problem

The built-in population feature is really useful; not just for