Skip to content

Instantly share code, notes, and snippets.

View bradvin.social.share.urls.txt
http://compose.mail.yahoo.com/?to={email_address}&subject={title}&body={url}
http://digg.com/submit?url={url}
http://pinterest.com/pin/create/link/?url={url}
http://service.weibo.com/share/share.php?url={url}&appkey=&title={title}&pic=&ralateUid=
http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}
http://surfingbird.ru/share?url={url}&description={text}&screenshot={image}&title={title}
http://vk.com/share.php?url={url}&title={title}&comment={text}
http://widget.renren.com/dialog/share?resourceUrl={url}&srcUrl={url}&title={title}&description={text}
http://www.addthis.com/bookmark.php?url={url}
http://www.douban.com/recommend/?url={url}&title={title}
@aheinze
aheinze / fuzzy-search.php
Last active Aug 20, 2018
Fuzzy Search function - returning score
View fuzzy-search.php
<?php
function fuzzy_search($search, $text, $distance = 3){
$needles = explode(' ', mb_strtolower($search, 'UTF-8'));
$tokens = explode(' ', mb_strtolower($text, 'UTF-8'));
$score = 0;
$levenshtein_utf8 = function ($s1, $s2) {
$map = [];
@aheinze
aheinze / gist:263225e99ca18e2dc2f636d49e7f6357
Last active Jul 13, 2016
Get css variable (cross browser)
View gist:263225e99ca18e2dc2f636d49e7f6357
/**
<style>
.var-test:before {
content: 'hello';
}
</style>
@aheinze
aheinze / execute.js
Last active Feb 25, 2016
Execute async function
View execute.js
/**
asyncexec(function(times){
for (var x=0, y;x<times;x++) {
y = x/2;
}
release(x);
@aheinze
aheinze / gist:02db57da725cf7ba4047
Last active Nov 29, 2021
letterAvatar - create Letter avatar based on name initials
View gist:02db57da725cf7ba4047
/*
* LetterAvatar
*
* Create Letter avatar based on Initials -
* based on https://gist.github.com/leecrossley/6027780
*/
(function(w, d){
function LetterAvatar (name, size) {
@aheinze
aheinze / gist:a3a702d652523021165b
Created May 28, 2015
replace color usage in style rules
View gist:a3a702d652523021165b
(function() {
var styles, style, rules, rule, error,
props = ['backgroundColor', 'color'], primaryColor = 'red', replaceColor: 'blue';
document.body.style.visibility = 'hidden';
try {
styles = document.styleSheets;
View gist:211636e42c0c209850f1
/**
USAGE:
Just load the script in the page loaded by the iframe.
<script src="seamless-iframe.js"></script>
**/
View elementsFromPoint.js
//
// returns a list of all elements under the cursor
//
function elementsFromPoint(x,y) {
var elements = [], previousPointerEvents = [], current, i, d;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x,y)) && elements.indexOf(current)===-1 && current != null) {
// push the element and its current style
@aheinze
aheinze / riot.view.js
Last active Aug 29, 2015
riot.view.js - inline compiled view templates
View riot.view.js
/**
USAGE:
<script src="riot+compiler.min.js"></script>
<script src="riot.view.js"></script>
<script type="riot/tag" src="my-tag.tag"></script>
<div riot-view>
View FuzzySearch.js
/*
* copyright: https://github.com/atom/fuzzaldrin - https://github.com/atom/fuzzaldrin/blob/master/LICENSE.md
*/
(function(global){
var filter, scorer, FuzzySearch;
/*
Original ported from: