Skip to content

Instantly share code, notes, and snippets.

@snakeneedy
snakeneedy / editor-in-browser.html
Last active May 21, 2020 04:13
A simple text editor in browser.
<!--
Put next line in URL.
data:text/html,<head><meta charset="utf-8"/></head><body style="margin:0;"><pre style="margin:0;height:100%;" contenteditable></pre></body>
-->
<head>
<meta charset="utf-8" />
</head>
<body style="margin:0;">
<pre style="margin:0;height:100%;" contenteditable></pre>
</body>
@snakeneedy
snakeneedy / parser.py
Last active October 27, 2016 01:50
Parse data from 'http://www.cwb.gov.tw/V7/observe/real/windAll.htm' into a object-list 'observeList' without print.
#!/usr/bin/python3
# target: "縣市"、"測站"、"風向"、"風速"、"陣風" 與 "時間"
"""
1. load html into string
2. parse string into class array
3. convert class into json
"""
import re
import json
import urllib.request
@snakeneedy
snakeneedy / notepad.html
Last active October 18, 2016 05:29 — forked from jdkanani/notepad.html
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;} .e *{font-size:14px;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@snakeneedy
snakeneedy / bookmarklet-youtube-embed.js
Created May 29, 2016 08:02
Make the video player on Youtube embed.
javascript:(function()%7Bvar%20uri=window.location.href;window.location.href=uri.replace(/watch%5C?v=/,%22embed/%22);%7D)();
// Source code:
/*
javascript:(function(){
var uri = window.location.href;
window.location.href = uri.replace(/watch\?v=/, "embed/");
})();
*/