Skip to content

Instantly share code, notes, and snippets.

<div class="example expose">Some content</div>
<textarea class="expose">Some content</textarea><br />
<input type="text" class="expose" value="Some content" /><br />
<div class="example expose">Some content</div><br /><br />
<textarea class="expose">Some content</textarea>
<div id="overlay"></div>
@wsd1
wsd1 / ds_rpc_permission_demo.js
Created February 19, 2017 19:48
deepstream 如何设置RPC访问权限,permission handler示例
var DeepstreamServer = require( 'deepstream.io' );
var server = new DeepstreamServer();
var C = server.constants;
var users = {
'mike': { canEditUser: true },
'lisa': { canEditUser: false }
};
var rpcs = {
'set-user-data': 'canEditUser'
};
@wsd1
wsd1 / web_draw.js
Created December 29, 2016 09:54
在DOM中绘图的尝试
function drawline(ax, ay, bx, by) {
console.log('ax: ' + ax);
console.log('ay: ' + ay);
console.log('bx: ' + bx);
console.log('by: ' + by);
@wsd1
wsd1 / pwc_PEG
Created December 29, 2016 09:17
This is pulse width codec for PEG.js
program_unit "程序"
= desc_unit+
desc_unit "描述单元"
= param:desc_unit_primitive+";"
{
/*\从PAWN虚拟机原码中提取的 KeeLoq 算法:
* Corrected KeeLoq Encryption and Decryption functions by Ruptor.
* Use at your own risk! This source is not copyrighted.
* Encoder encrypts an all-0 block, decoder decrypts it.
* KeeLoq cipher encrypts 32-bit blocks with 64-bit keys.
* Key is XORed with a 32-bit IV incremented on each use.
* See http://www.keeloq.boom.ru/decryption.pdf for more details.
* KeeLoq algorithm itself is not patented.
\*/
#include "amx.h"
/*
使用 localStorage 来记录 JWT 认证,以及如何设置 Authorization 头部:
http://stackoverflow.com/questions/35861012/how-to-send-a-token-with-an-ajax-request-from-jquery
*/
$.ajax({
<html>
<head>
<title>ucast.io</title>
<style>
.ness {
position: absolute;
top: 50%;
left: 50%;
font-size: 200%;
transform: translateX(-50%) translateY(-50%);
@wsd1
wsd1 / index.js
Created July 27, 2014 17:06
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")