Skip to content

Instantly share code, notes, and snippets.

View marcsolanadal's full-sized avatar

Marc Solà Nadal marcsolanadal

View GitHub Profile
@marcsolanadal
marcsolanadal / readwise-settings.md
Last active January 20, 2023 15:06
Readwise settings

File name

{{title|replace(' ','-')|lower()|replace(""","")|replace(""","")|replace("'","")|replace("'","")|truncate(127)}}

I do this so that weird characters or overly-long file names don't break dropbox or git, since Readwise doesn't natively sanitize things.

Page title

Page metadata

@marcsolanadal
marcsolanadal / pitch-accent-injector.js
Created January 11, 2022 08:42
This script injects the pitch accent color only using the pitch accent graph generated by the AJT addon.
const downStepChar = "ꜜ";
const pitchAccentMap = {
'平板': '#3366CC',
'頭高': 'red',
'中高': 'green',
'尾高': '#ff6207'
};
function paintTargetWord(color) {
for (sentence of document.getElementsByClassName("jpsentence")) {
Search
Focused*
blur -> Not Focused
Empty
typed -> Suggesting
Error
emptied -> Empty
/**
* STATE PATTERN
*
* The State object:
* - Determines the transition to the next state.
* - Changes the current state in the state machine
*/
function trafficLight() {
const State = Object.freeze({
@marcsolanadal
marcsolanadal / index.html
Created August 22, 2017 19:45
JS Bin example of a simple progress bar // source https://jsbin.com/comimeq
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="example of a simple progress bar">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.container {
display: flex;
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
<html>
<head>
<title>dropdown-with-events</title>
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.2.0/redux-thunk.js"></script>
@marcsolanadal
marcsolanadal / index.html
Created April 26, 2017 14:49
onblur-onmousedown-example
<html>
<head>
<title>dropdown-with-events</title>
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.2.0/redux-thunk.js"></script>
<html>
<head>
<title>dropdown-with-events</title>
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.2.0/redux-thunk.js"></script>
@marcsolanadal
marcsolanadal / index.html
Created April 18, 2017 11:31
Example of async thunks
<html>
<head>
<title>react-redux-fiddle</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.2.0/redux-thunk.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js"></script>