Skip to content

Instantly share code, notes, and snippets.

@cobyism
cobyism / gh-pages-deploy.md
Last active May 3, 2024 19:07
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 dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@bgusach
bgusach / multireplace.py
Last active April 23, 2024 18:46
Python string multireplacement
def multireplace(string, replacements, ignore_case=False):
"""
Given a string and a replacement map, it returns the replaced string.
:param str string: string to execute replacements on
:param dict replacements: replacement dictionary {value to find: value to replace}
:param bool ignore_case: whether the match should be case insensitive
:rtype: str
"""
@zetavg
zetavg / sb-calibre-azw3-kindle.md
Last active April 11, 2024 19:14
直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版(翻頁相反、字體走位)的解決方法。

直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版的解決方法

圖為修正後範例。

有些直書書籍轉成 azw3 後排版會跑掉,在 Kindle 上僅剩翻頁變相反、從左到右的(因為原本是直書呀)。這裡是一些解決方法。

首先對要修正的書按右鍵選編輯,然後選 AZW3

1. 直書變橫書

@Schwusch
Schwusch / selection_transformer.dart
Last active April 11, 2024 01:49 — forked from schultek/selection_transformer.dart
A widget that transforms the text selection when copied.
import 'package:collection/collection.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
typedef SelectionTransform = String Function(Iterable<String>);
/// A widget that transforms the text selection when copied.
///
/// This uses the [SelectionContainer] with a custom [SelectionContainerDelegate] to override the
/// [getSelectedContent] method with a custom implementation.
@matthiassb
matthiassb / dns-sync.sh
Last active March 20, 2024 12:12
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@tduarte
tduarte / publish-ghpages.md
Last active March 15, 2024 05:45
If you need to force push an subtree
git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
@hscspring
hscspring / 结巴词性标记集
Last active February 27, 2024 11:32
结巴词性对照表
- a 形容词
- ad 副形词
- ag 形容词性语素
- an 名形词
- b 区别词
- c 连词
- d 副词
- df
- dg 副语素
- e 叹词
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
| 名称 | Unicode | 符号 |
| ---- | ------- | ---- |
| 间隔号 | 00B7\U+FF0E | ·\. |
| 连接号 | 2013 | – |
| 破折号 | 2014 | —— |
| 引号 | 2018\2019 | ‘’ |
| 引号 | 201C\201D | “” |
| 省略号 | 2026 | …… |
| 顿号 | 3001 | 、 |
| 句号 | 3002 | 。 |