Skip to content

Instantly share code, notes, and snippets.

@tlxue
tlxue / json
Created February 21, 2017 08:55
json
{
"text": "看到 Kevin Rose 去年的 New Year Resolutions 后受到启发,我也来列一列 2017 年的愿望清单。 ",
"cell_type": "paragraph_cell",
"tag": "p",
"mentions": [
],
"index": "j8sk"
},
{
@tlxue
tlxue / title and url
Created October 10, 2014 05:46
show title and url
!function(){var t=document.createElement("span");t.innerHTML=document.title+"<br>"+document.location.href,t.setAttribute("style","position:fixed;background:rgba(0,0,0,.6);color:white;left:0;top:0;font-size:16px;padding:10px 0;z-index:10000;width:100%;text-align:center;"),document.body.appendChild(t)}();
@tlxue
tlxue / linkToQrcode
Last active August 29, 2015 13:59
Generate a qrcode from current page's link.
javascript:(function(){document.location.href='https://chart.googleapis.com/chart?chs=150x150&cht=qr&choe=UTF-8&chl='+encodeURIComponent(document.location.href);})()
// 根据当前页面生成 QR code 的 bookmarklet
// 用到了 Google Chart API: https://developers.google.com/chart/infographics/docs/qr_codes?csw=1
.content {
margin: 15px 15px 0;
}
.footer {
text-align: center;
}
.footer a {
margin: 40px auto;
@tlxue
tlxue / gist:5089290
Created March 5, 2013 10:18
remove outline
input:focus {
outline: none;
box-shadow: 0 0 8px rgba(105, 142, 191, .5);
border: 1px solid #B0C4DD;
}
@tlxue
tlxue / example.json
Last active December 11, 2015 23:59
{
"name": "知乎精选集 2012",
"chapters": [
{
"name": "互联网",
"intro": "这是一句导语",
"articles": [
{
"link": "/question/20750699/answer/16053345",
"title": "Tim Cook 为什么说「一个 iPhone 部门比整个微软优秀」?如何评价这个说法?",
@tlxue
tlxue / gist:4666300
Created January 29, 2013 18:14
在豆瓣电影中点一下即可标记为想看。
$.ajax({
type: "POST",
url: "http://movie.douban.com/j/subject/4319445/interest",
data: { ck: "cWiS", interest: "wish" },
success: function () { console.log('想看') },
dataType: "json"
});
@tlxue
tlxue / gist:4116198
Created November 20, 2012 05:22
shake
(function( $, undefined ) {
$.effects.shake = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['position','top','bottom','left','right'];
// Set options
@tlxue
tlxue / gist:2723572
Created May 18, 2012 06:33
Feed Exp Data Format
{
"items" : [
{
"actions" : [
{
"item_type" : "问题/回答",
"action_type" : "关注/添加/赞成",
"source" : {
"type" : "topic/question/person",
"name" : "topic/person/question name",
@tlxue
tlxue / gist:2710397
Created May 16, 2012 13:39
reverse ClassName
javascript:(function(){function fuckThemAll(a){var b;for(var c in a){b=document.querySelectorAll("."+a[c]);if(!!b){for(var d=0;d<b.length;d++){b[d].className+=" "+c;b[d].setAttribute("data-map",!b[d].getAttribute("data-map")?classMapping[c]+":"+c:b[d].getAttribute("data-map")+" "+classMapping[c]+":"+c)}}}}function request(){var a=new XMLHttpRequest;a.open("GET",mappingURL,false);a.send(null);return a.responseText}var mappingURL="http://"+window.location.hostname+"/static/js/v2/c/sybols.js?2",mapping;mapping=request();mapping="window.classMapping ="+mapping.slice(mapping.indexOf("{"),mapping.lastIndexOf("}")+1);eval(mapping);fuckThemAll(classMapping)})()