Skip to content

Instantly share code, notes, and snippets.

@dinh
dinh / greasestarter.user.js
Created December 21, 2022 22:01 — forked from bmcminn/greasestarter.user.js
JS: A simple boilerplate Grease/Tampermonkey script. This starter script aliases a custom jQuery instance on the page so you can start doing some fancy dom manipulation stuffs with absolutely no consequences.
// ==UserScript==
// @name SCRIPT_NAME_HERE
// @namespace NAMESPACE
// @version 0.1
// @description WIDGET_DESCRIPTION_HERE
// @match http*://*/*
// @include http*://*/*
// @copyright 2013+, YOURNAME
// ==/UserScript==
@dinh
dinh / userscript.js
Created December 21, 2022 21:59 — forked from dataserver/userscript.js
tampermonkey userscript boilerplate
// ==UserScript==
// @name userscript boilerplate
// @namespace userscriptnamespace
// @version 1
// @description Script description
// @author Author
// @match http://asdf.com/*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-popup-overlay/2.1.1/jquery.popupoverlay.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery.serializeJSON/2.9.0/jquery.serializejson.min.js
@dinh
dinh / data-markdown.user.js
Created December 21, 2022 21:42 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@dinh
dinh / include-callback.js
Created December 21, 2022 21:39 — forked from jr-codes/include-callback.js
include(): JavaScript function for dynamically including a CSS or JS file on a page
/**
* Includes the CSS or JS file into the head of the page.
*
* Examples:
* include('http://example.com/script.js')
* include('http://example.com/style.css')
* include('http://example.com/script.php', 'js')
* @param {string} url URL of the CSS or JS file
* @param {string} [type] 'css' or 'js' to specify the type of file.
* This parameter is optional, but it should be
@dinh
dinh / open-json.user.js
Created December 21, 2022 21:37 — forked from jr-codes/open-json.user.js
Userscript for opening JSON in the Chrome JSON Viewer extension
// ==UserScript==
// @name Open JSON
// @version 1.0.0
// @description Opens JSON in a json-viewer window
// @match http://*/*
// @match https://*/*
// ==/UserScript==
const exec = fn => {
const script = document.createElement('script');
@dinh
dinh / context-and-localstorage-using-hooks.js
Created December 11, 2022 10:34 — forked from jimode/context-and-localstorage-using-hooks.js
Providing Context and Local Storage Using Hooks
// Providing Context
// ==================
import React, {useState, useEffect} from "react"
const Context = React.createContext()
function ContextProvider({children}) {
const [allPhotos, setAllPhotos] = useState([])
const [cartItems, setCartItems] = useState([])
@dinh
dinh / chatgpt_parser_md.py
Created December 4, 2022 20:19 — forked from thomasantony/chatgpt_parser_md.py
Convert saved HTML transcripts from ChatGPT to Markdown
# Save the transcripts using the "Save Page WE" Chrome Extension
# This script was generated by ChatGPT
import sys
from bs4 import BeautifulSoup
# Check if a file was provided as a command line argument
if len(sys.argv) < 2:
print("Please provide an HTML file as a command line argument.")
sys.exit(1)
@dinh
dinh / modify-dom.txt
Created November 26, 2022 16:20 — forked from ahliang85/modify-dom.txt
Chrome Extension - Modify DOM
Background page is kind of like you own mini server - it is a completely isolated page that has nothing to do with pages a user visits. It is used for controlling the rest of extension components as it is always running in background.
Content scripts are pieces of javascript code that are getting injected into actual pages a user visits and can access and modify parent page's DOM.
So to get your extension working you need to remove
<script src="jquery.min.js"></script>
<script src="content.js"></script>
from background page, and inject jquery as a content script either through manifest:
@dinh
dinh / dnsmasq OS X.md
Created November 14, 2022 17:45 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@dinh
dinh / ubuntu_devenv.sh
Created November 13, 2022 21:35 — forked from esavard/ubuntu_devenv.sh
Ubuntu post installation script that setup a development environment using dialogs
#!/bin/bash
#===================================================================================
# ubuntu_devenv.sh
# http://symbiosoft.net/ubuntu_devenv
#
# (K)UBUNTU - POST INSTALLATION SCRIPT THAT SETUP A DEVELOPER ENVIRONMENT
#
# TODOLIST
#----------------------------------------------------------------------------------
# - Simulation (no changes)