Skip to content

Instantly share code, notes, and snippets.

View taurenshaman's full-sized avatar
💤
lore:> hi knowledge

Jerin taurenshaman

💤
lore:> hi knowledge
View GitHub Profile
@taurenshaman
taurenshaman / BrightstarDB.Jobs.sql
Last active December 17, 2015 11:59
add a prefix "Brightstar_" to BrightstarDB/BrightstarDB/tree/master/src/azure/sql/Jobs.sql and relative SqlJobQueue.cs
/**
* Creates the job queue table and stored procedures in the database
*/
DROP ROLE brightstar_role_gateway
GO
DROP PROCEDURE [dbo].[Brightstar_CompleteJob]
GO
DROP PROCEDURE [dbo].[Brightstar_GetJob]
@taurenshaman
taurenshaman / Append or update
Created June 14, 2013 11:37
Simple Enhancement for User's password @ FunnelWeb
【add Script0033.sql】
--add Salt field to User table
alter table $schema$.[User] add [Salt] nchar(32) null
go
【FunnelWeb.Model.Authentication.Mappings.UserMapping.cs】
Append:
@taurenshaman
taurenshaman / Compare two numbers no convert
Last active September 1, 2018 04:44
compare two numbers stored as strings without converting them to double/int/float
// https://stackoverflow.com/a/14468767
var numbers = new string[] { "100" ,"200", "100.1" , "200.1" };
int N = 100;
var max = numbers.Select(n => n.Split('.'))
.OrderByDescending(p => p[0].PadLeft(N,'0'))
.ThenByDescending(p => p.Length > 1 ? p[1].PadRight(N, '0') : "")
.Select(p => p.Length > 1 ? p[0] + "." + p[1] : p[0])
.First();
did:3:bafyreifq6fa7gz5w65lkul5qbjsbiflu5geuzo5o5dzo7cs3dkm2msnqvm
class KatexModule {
constructor({ data, api }) {
this.data = data;
this.api = api;
this.wrapper = undefined;
this.settings = [
{
name: 'edit',
title: 'Edit',
@taurenshaman
taurenshaman / disable-tab-nav.js
Created June 5, 2020 11:27
Disable Tab navigation
document.onkeydown = function (evt) {
if (evt.which === 9) {
//console.log(evt);
return false;
}
}
// source: https://www.sanwebcorner.com/2016/07/how-to-disable-tab-key-in-web-page.html
// if wanna disable a spesific element:
//<input tabindex="-1" placeholder="NoTabIndex" />
@taurenshaman
taurenshaman / blake2b-signer.ts
Created March 5, 2021 06:40
pw-core/src/signers/blake2b-signer.ts
import { Hasher } from '.';
import { Reader } from 'ckb-js-toolkit';
import blake2b from 'blake2b';
export class Blake2bHasher extends Hasher {
constructor(key: string = null) {
const keyData = !key || key.length === 0 ? null : Buffer.from(key);
const h = blake2b(
32,
keyData,
@taurenshaman
taurenshaman / blake2b-signer.ts
Created March 5, 2021 06:43
pw-core/src/signers/blake2b-signer.ts
import { Signer, Message } from '.';
import { Blake2bHasher } from '../hashers';
import { Provider } from '../providers';
export class Blake2bSigner extends Signer {
constructor(public readonly provider: Provider, key: string = null) {
super(new Blake2bHasher(key));
}
@taurenshaman
taurenshaman / raw-provider.ts
Last active March 5, 2021 06:53
F:\Github\pw-core\src\providers\raw-provider.ts
import { Provider, Platform } from './provider';
import { Address, AddressType } from '..';
import { Blake2bSigner } from '../signers/blake2b-signer';
// 基于DummyProvider修改
export class RawProvider extends Provider {
secret: string;
signer: Blake2bSigner;
sign(message: string): Promise<string> {