Skip to content

Instantly share code, notes, and snippets.

@dinh
dinh / export-google-music-playlist.user.js
Last active August 29, 2015 14:27 — forked from Metapyziks/export-google-music-playlist.user.js
Adds a button to export a Google Music playlist.
// ==UserScript==
// @name Export Google Music Playlist
// @namespace http://ziks.net/
// @version 0.1
// @description Adds a button to export a Google Music playlist
// @author Ziks
// @match https://play.google.com/music/listen
// @require http://code.jquery.com/jquery-latest.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js
// @grant none
@dinh
dinh / nikkei_scraper.user.js
Last active August 29, 2015 14:27 — forked from teruhisa/nikkei_scraper.user.js
Nikkei Scraper
// ==UserScript==
// @name Nikkei Scraper
// @namespace http://http://teruhisa.github.io//
// @version 0.1
// @description scrape news article content and dump it into body.
// @author Teruhisa Haruguchi
// @match https://gateway.itc.u-tokyo.ac.jp/g3/,DanaInfo=t21.nikkei.co.jp+CMN0F12.do
// @match https://t21.nikkei.co.jp/g3/CMN0F12.do
// @grant none
// ==/UserScript==
@dinh
dinh / screenscraper.user.js
Last active August 29, 2015 14:27 — forked from axemclion/screenscraper.user.js
Screen Scraper Template
// ==UserScript==
// @name ScreenScraperTemplate
// @namespace http://dy-verse.blogspot.com
// @include http://page.you.wanna.scrape/path?pageName?pageNumber=*
// ==/UserScript==
/**
* This function is responsible for submitting the data
* @param {Object} parsedData
* @param {Object} record
@dinh
dinh / gist:155760aba648a39fb9e8
Created September 4, 2015 13:29
Use sprintf in php
$logMessage = sprintf('A %s with email %s has performed %s on %s.', $user->type, $user->email, $action, $subject);
@dinh
dinh / Makefile
Last active September 6, 2015 21:09 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@dinh
dinh / gist:ce499878d187181e9747
Created September 8, 2015 14:10
Animated info message at the top using jQuery
$('<div>jQuery is running!</div>')
.css({padding: '10px', background: '#ffc', position: 'absolute',top: '0', width: '100%'})
.prependTo('body')
.fadeIn('fast')
.animate({opacity: 1.0}, 1800)
.fadeOut('slow', function() {
$(this).remove();
});
@dinh
dinh / jQuery Bookmarklet.js
Last active March 26, 2016 14:36
jQuery Bookmarklet
// http://coder-zone.blogspot.fr/2009/05/jquery-bookmarklet.html
// Encapsulation
(function(){
// Check if jQuery is loaded
if(typeof window.jQuery != 'undefined') {
message('jQuery already loaded')
} else {
// Check for conflicts
var conflict = typeof window.$ != 'undefined';
// Create the script and point to Google API
@dinh
dinh / gist:7add4b3190eec48c59e2
Created October 19, 2015 21:47 — forked from rajeshg/gist:664217
Delicious bookmarklet which opens the delicious url in a seperate window. This is a slightly modified version of the official delicious bookmarklet
javascript:(function(){window.open('http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&jump=doclose');})()
@dinh
dinh / String.prototype.format
Created March 28, 2016 20:17
Create a new method "format" to the for JavaScrip string object. Useful for bookmarklet
/**
* Create a new method "format" to the for JavaScrip string object
* Example of use :
* var styleTpl = "<style>{0} {1}</style>",
* style1 = ".hidden {visibility: hidden;}",
* style1 = ".rouge {color: red;}";
* styleTpl.format(style1, style2) -> <style>.hidden {visibility: hidden;} .rouge {color: red;}</style>
* From : https://github.com/afshinm/Json-to-HTML-Table/blob/master/json-to-table.js
*/
String.prototype.format = function()
@dinh
dinh / curlp.pl
Created March 30, 2016 13:26 — forked from mpcabd/curlp.pl
curl with Proxy auto-config (PAC) files
#!/usr/bin/env perl
# This work is licensed under the GNU Public License (GPLv3).
# To view a copy of this license, visit http://www.gnu.org/copyleft/gpl.html
# To read more about this script go to: http://mpcabd.igeex.biz/using-curl-with-proxy-pac-configuration-files/
use strict;
use warnings;