Skip to content

Instantly share code, notes, and snippets.

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 August 20, 2018 07:44
Fuzzy Search function - returning score
<?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 July 13, 2016 07:45
Get css variable (cross browser)
/**
<style>
.var-test:before {
content: 'hello';
}
</style>
@aheinze
aheinze / execute.js
Last active February 25, 2016 16:05
Execute async function
/**
asyncexec(function(times){
for (var x=0, y;x<times;x++) {
y = x/2;
}
release(x);
@aheinze
aheinze / gist:02db57da725cf7ba4047
Last active October 30, 2022 07:30
letterAvatar - create Letter avatar based on name initials
/*
* 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 09:19
replace color usage in style rules
(function() {
var styles, style, rules, rule, error,
props = ['backgroundColor', 'color'], primaryColor = 'red', replaceColor: 'blue';
document.body.style.visibility = 'hidden';
try {
styles = document.styleSheets;
@aheinze
aheinze / gist:211636e42c0c209850f1
Last active August 29, 2015 14:19
seamless-iframe.js
/**
USAGE:
Just load the script in the page loaded by the iframe.
<script src="seamless-iframe.js"></script>
**/
//
// 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 August 29, 2015 14:19
riot.view.js - inline compiled view templates
/**
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>
/*
* copyright: https://github.com/atom/fuzzaldrin - https://github.com/atom/fuzzaldrin/blob/master/LICENSE.md
*/
(function(global){
var filter, scorer, FuzzySearch;
/*
Original ported from: