Skip to content

Instantly share code, notes, and snippets.

@codeyu
codeyu / dnd.js
Created February 25, 2016 07:14 — forked from npow/dnd.js
PhantomJS drag and drop
var page = require('webpage').create();
page.open('http://jsbin.com/ifuma#noedit', function () {
setTimeout(function () {
page.sendEvent("mousedown", 10, 10);
page.sendEvent("mousemove", 200, 200);
page.sendEvent("mouseup", 200, 200);
page.render('ss.png');
phantom.exit();
}, 3000);
});
@codeyu
codeyu / gh-pages-deploy.md
Created August 14, 2017 00:31 — 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 dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@codeyu
codeyu / k8s-pi.md
Created December 12, 2017 05:51 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

@codeyu
codeyu / CryptoRandom.cs
Created December 24, 2017 14:31 — forked from prettycode/CryptoRandom.cs
Cryptographically-strong random number generator in C#.
// Cryptographically-strong random number generator
// Source: MSDN Magazine > 2007 > September > .NET Matters: Tales from the CryptoRandom
// Source URL: http://msdn.microsoft.com/en-us/magazine/cc163367.aspx
// Authors: Stephen Toub & Shawn Farkas
public class CryptoRandom : Random
{
private RNGCryptoServiceProvider cryptoProvider = new RNGCryptoServiceProvider();
private byte[] uint32Buffer = new byte[4];
@codeyu
codeyu / hiragana2romaji.js
Created August 30, 2024 22:12 — forked from shimataro/hiragana2romaji.js
ひらがな→ローマ字変換
exports.default = hiragana2romaji;
// 変換テーブル; 文字数の多いものから登録していく
const convtables = [
{ // 3文字
"っきゃ": "kkya",
"っきぃ": "kkyi",
"っきゅ": "kkyu",
"っきぇ": "kkye",
"っきょ": "kkyo",