Skip to content

Instantly share code, notes, and snippets.

View abnerCrack's full-sized avatar
🏠
Working.

C abnerCrack

🏠
Working.
View GitHub Profile
@abnerCrack
abnerCrack / setup.sh
Last active September 10, 2021 09:42
# 解决阿里云、腾讯云无法git clone
# 镜像到阿里源
git config --global url."https://git.521000.best.cnpmjs.org/".insteadOf "https://github.com/"
git config --global protocol.http.allow always
# 备选
git config --global url."https://hub.fastgit.org/".insteadOf "https://github.com/"
git config --global protocol.http.allow always
@abnerCrack
abnerCrack / install-sonar-scanner.sh
Last active December 19, 2019 09:20 — forked from chetanppatil/install-sonar-scanner.sh
Install sonar-scanner in linux mint, ubuntu...
#!/bin/bash
cd /tmp || exit
echo "Downloading sonar-scanner....."
if [ -d "/tmp/sonar-scanner-cli-4.0.0.1744-linux.zip" ];then
sudo rm /tmp/sonar-scanner-cli-4.0.0.1744-linux.zip
fi
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-linux.zip
echo "Download completed."
for i in ./*.js;
do mv "$i" "${i%.js}.ts";
done
### Keybase proof
I hereby claim:
* I am abnercrack on github.
* I am abnercrack (https://keybase.io/abnercrack) on keybase.
* I have a public key ASAytDTTleMxIxxC9fbBWJn8rX6MuAGrrhFjIU7Hvm34Dwo
To claim this, I am signing this object:
@abnerCrack
abnerCrack / scale-canvas.js
Created August 10, 2018 07:31 — forked from callumlocke/scale-canvas.ts
Function to fix a canvas so it will look good on retina/hi-DPI screens.
/**
* This function takes a canvas, context, width and height. It scales both the
* canvas and the context in such a way that everything you draw will be as
* sharp as possible for the device.
*
* It doesn't return anything, it just modifies whatever canvas and context you
* pass in.
*
* Adapted from Paul Lewis's code here:
* http://www.html5rocks.com/en/tutorials/canvas/hidpi/
@abnerCrack
abnerCrack / use-node-open-terminal.md
Created June 6, 2018 10:37 — forked from neekey/use-node-open-terminal.md
在nodeJS中启动一个teminal窗口执行相关进程

Mac

使用open 命令,调用terminal来打开abc这个文件:

open -a /Applications/Utilities/Terminal.app "abc"

期中-a这个参数保证打开一个新的terminal实例

Node.js 镜像: http://npm.taobao.org/mirrors/node
alinode 镜像: http://npm.taobao.org/mirrors/alinode
phantomjs 镜像: http://npm.taobao.org/mirrors/phantomjs
ChromeDriver 镜像: http://npm.taobao.org/mirrors/chromedriver
OperaDriver 镜像: http://npm.taobao.org/mirrors/operadriver
Selenium 镜像: http://npm.taobao.org/mirrors/selenium
Node.js 文档镜像: http://npm.taobao.org/mirrors/node/latest/docs/api/index.html
NPM 镜像: https://npm.taobao.org/mirrors/npm/
electron 镜像: https://npm.taobao.org/mirrors/electron/
node-inspector 镜像: https://npm.taobao.org/mirrors/node-inspector/
handler.on('push', function (event) {
console.log('Received a push event for %s to %s',
event.payload.repository.name,
event.payload.ref)
run_cmd('sh', ['./update.sh'], function(text){ console.log(text) })
@abnerCrack
abnerCrack / app.js
Created April 29, 2017 18:05 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@abnerCrack
abnerCrack / gist:501e6c96655f8fa5838fba3fb85d78f6
Created August 22, 2016 08:02 — forked from ndrut/gist:4549230
Render an image in base64 using phantom js. Convert the base64 into a raw binary buffer, pass the binary buffer to GraphicsMagic which can write to a writable stream, collect the chunks of data in separate buffers, storing them in an array and then concatenate them all together.
// PhantomJS Render to base64 function
page.renderBase64('png', function(err, img) {
var image = {};
image.thumb = [];
final.full = new Buffer(img, 'base64'); // Convert the base64 encoded value into binary.
var thumbStream = new stream.Stream(); // Create a new writable stream
thumbStream.writable = true;
thumbStream.write = function (chunk) {
image.thumb.push(chunk); // Take the data written and store it into an array