Skip to content

Instantly share code, notes, and snippets.

@ashramwen
ashramwen / remove.js
Created June 24, 2025 07:30
Remove tracking codes
// ==UserScript==
// @name Remove tracking seeds
// @namespace http://tampermonkey.net/
// @version 2025-05-20
// @description try to take over the world!
// @author You
// @match *://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=facebook.com
// @grant none
// ==/UserScript==
@ashramwen
ashramwen / solution.js
Created October 2, 2021 15:43
fizz buzz
/**
* @param {number} n
* @return {string[]}
*/
var fizzBuzz = function (n) {
const output = [];
// 題目明白寫了 1-indexed,所以 i 從 1 開始
for (let i = 1; i <= n; i++) {
if (i % 15 === 0) {
@ashramwen
ashramwen / .gitignore
Created February 9, 2021 08:56 — forked from andreasonny83/.gitignore
Gitignore template for JavaScript projects
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Runtime data
pids
*.pid
@ashramwen
ashramwen / detect-history-state.js
Last active January 28, 2021 03:10 — forked from rudiedirkx/detect-history-state.js
Detect pushState and replaceState
var _wr = function(type) {
var orig = history[type];
return function() {
var rv = orig.apply(this, arguments);
var e = new Event(type);
e.arguments = arguments;
window.dispatchEvent(e);
return rv;
};
};
@ashramwen
ashramwen / download-file.js
Created October 6, 2020 02:51 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@ashramwen
ashramwen / gh-pages-deploy.md
Last active June 5, 2020 02:43 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the build directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@ashramwen
ashramwen / git-delete-local-tag.sh
Created March 3, 2020 03:48 — forked from canhnt/git-delete-local-tag.sh
Delete local tags that do not exist in remote
git fetch --prune origin "+refs/tags/*:refs/tags/*"