Skip to content

Instantly share code, notes, and snippets.

@dinh
dinh / iz_dbg_bookmarklet
Last active August 29, 2015 14:00
Javascript: IdZone debugger bookmarklet
javascript:
(function(){
function syntaxHighlight(json){
if(typeof json!='string'){
json=JSON.stringify(json,undefined,2);
}
json=json.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function (match){var cls='number';if(/^"/.test(match)){if(/:$/.test(match)){cls='key';}else{cls='string';}}else if(/true|false/.test(match)){cls='boolean';}else if(/null/.test(match)){cls='null';}return '<span class="'+cls+'">'+match+'</span>';});
}
function loadjscssfile(filename,filetype,id){
@dinh
dinh / bbmodel.sublime-snippet
Last active August 29, 2015 14:00
Javascript: Backbone Model snippet for SBT
<snippet>
<content><![CDATA[
window.model_name = Backbone.Model.extend({ //instance members
url: "",
idAttribute: "_id",
initialize: function() {
},
default: function() {
@dinh
dinh / data_image_logo_orange_16
Created May 20, 2014 07:19
Logo Orange 16x16
data:image/gif;base64,R0lGODlhEAAQAKUAAPxiBPyiZPyCNPzClPxyHPzStPyyhPyWVPzKpPx6JPxqDPyqdPyORPzGpPy+lPyeXPx+NPyGNPzGnPy2hPzOrPx+LPxmBPymbPzCnPx2HPzexPyaXPzKrPx6LPxuFPyudPyeZPyGPPy2jP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACMALAAAAAAQABAAAAZNQItwSCwaj8ikcslsOp/QqHQIEAKuV0s2azkkEpSHQ/wQISIDw2LS8SwgBUxogsAYGqGCxuCxZDAMARAiIA8bDA0cAQZUWlpYBAsRXEEAOw==
@dinh
dinh / gist:52f29e2c1445333ff22e
Created February 3, 2015 21:33
Verifying that +dinhvu is my openname (Bitcoin username). https://onename.com/dinhvu
Verifying that +dinhvu is my openname (Bitcoin username). https://onename.com/dinhvu
#http://www.sitepoint.com/shorthand-javascript-techniques/
1. If true … else Shorthand
var big = (x > 10) ? true : false;
var big = (x > 10);
//further nested examples
var x = 3,
big = (x > 10) ? "greater 10" : (x < 5) ? "less 5" : "between 5 and 10";
@dinh
dinh / cookie.js
Last active August 29, 2015 14:23
javascript:cookie
@dinh
dinh / firefox tweak
Created August 17, 2015 16:08
firefox tweak
Further reading:
http://kb.mozillazine.org/About:config_entries (Outdated)
http://thesimplecomputer.info/tscs-firefox-tweak-guide
https://www.privacytools.io/#about_config
----------------------------------------------------
SPEED
@dinh
dinh / leboncoin.user.js
Last active August 29, 2015 14:27 — forked from fmagnan/leboncoin.user.js
formatted leboncoin.fr results
// ==UserScript==
// @name leboncoin
// @namespace marvin.org
// @include http://www.leboncoin.fr/*/offres/*
// @include http://www.leboncoin.fr/li*
// @version 1
// @grant none
// ==/UserScript==
/* jshint strict: true */
@dinh
dinh / enregistreurleboncoin.user.js
Last active August 29, 2015 14:27 — forked from jhemono/enregistreurleboncoin.user.js
Enregistreur d'annonces
// ==UserScript==
// @name Enregistrement d'annonce leboncoin.fr
// @version 0.3
// @description Ajoute la possibilité d'enregistrer des annonces sur leboncoin.fr
// @updateURL https://gist.githubusercontent.com/jhemono/32444bada82ae7972d5a/raw/enregistreurleboncoin.user.js
// @grant none
// @include http://www2.leboncoin.fr/ai/form/*
// @noframes
// ==/UserScript==
@dinh
dinh / on.js
Last active August 29, 2015 14:27 — forked from johan/on.js
A highly useful userscript function for filtering web pages by DOM contents, pathnames and otherwise.
/* coffee-script example usage - at https://github.com/johan/dotjs/commits/johan
on path_re: ['^/([^/]+)/([^/]+)(/?.*)', 'user', 'repo', 'rest']
query: true
dom:
keyboard: 'css .keyboard-shortcuts'
branches: 'css+ .js-filter-branches h4 a'
dates: 'css* .commit-group-heading'
tracker: 'css? #gauges-tracker[defer]'
johan_ci: 'xpath* //li[contains(@class,"commit")][.//a[.="johan"]]'