Skip to content

Instantly share code, notes, and snippets.

View bhaltair's full-sized avatar
🎯
Focusing

www bhaltair

🎯
Focusing
View GitHub Profile
@bhaltair
bhaltair / .deps...npm...hardhat...console.sol
Created April 18, 2023 11:43
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
@bhaltair
bhaltair / .deps...npm...hardhat...console.sol
Created April 18, 2023 11:14
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
@bhaltair
bhaltair / HemaJSBridge.js
Created March 6, 2018 03:15
合码 js bridge
const mustFunc = (v) => {
return getObjectType(v) === 'Function'
? v
: () => {}
}
const getObjectType = (v) => {
return Object.prototype.toString.call(v).slice(8, -1)
}
class HemaJSBridge {
/**
@bhaltair
bhaltair / mobile.html
Created February 28, 2018 07:26
移动端h5模板
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" >
<meta name="format-detection" content="telephone=no" >
<title>移动端HTML模版</title>
<!-- S DNS预解析 -->
<link rel="dns-prefetch" href="">
@bhaltair
bhaltair / wechat_jump_helper.py
Created January 1, 2018 13:34
wechat_jump_helper
import requests
import json
import time
from Crypto.Cipher import AES
import base64
action_data = {
"score": 666,
"times": 666,
"game_data": "{}"
@bhaltair
bhaltair / vue-awesome-swiper.js
Created December 1, 2017 09:04
vue-awesome-swiper.js
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("swiper"),require("object-assign")):"function"==typeof define&&define.amd?define(["swiper","object-assign"],t):"object"==typeof exports?exports.VueAwesomeSwiper=t(require("swiper"),require("object-assign")):e.VueAwesomeSwiper=t(e.swiper,e["object-assign"])}(this,function(e,t){return function(e){function t(s){if(n[s])return n[s].exports;var i=n[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,s){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=4)}([function(t,n){t.exports=e},function(e,t){e.exports=function(e,t,n,s,i,r){var o,a=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(o=e,a=e.default);
@bhaltair
bhaltair / head.html
Created October 27, 2017 02:05
head sample
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="BiliLink 相簿,联结众多画师、Coser 及 ACG 爱好者,是国内最优秀的图片社交平台。Link Start!">
<meta name="keywords" content="哔哩哔哩,ACG,cos,cosplay,coser,动漫,二次元,同人,绘画,阴阳师,手游,耽美,守望先锋,全职高手">
<meta name="application-name" content="哔哩哔哩相簿,绘你所想,拍你所爱">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="theme-color" content="#4393E2">
@bhaltair
bhaltair / image2canvas.js
Created September 7, 2017 07:15
image2canvas
function toDataURL(src, callback, outputFormat) {
var img = new Image();
img.crossOrigin = 'Anonymous';
img.onload = function() {
var canvas = document.createElement('CANVAS');
var ctx = canvas.getContext('2d');
var dataURL;
canvas.height = this.naturalHeight;
canvas.width = this.naturalWidth;
ctx.drawImage(this, 0, 0);
@bhaltair
bhaltair / readfile.js
Created August 25, 2017 05:55
node read file
var fs = require('fs')
// fs.readdir(__dirname, function (err, files) {
// // body...
// console.log(files)
// })
console.log('now path is: ' + process.cwd())
fs.readdir(process.cwd(), function (err, files) {
// body...
console.log('')