Skip to content

Instantly share code, notes, and snippets.

View xuyuji9000's full-sized avatar

Karl Xu xuyuji9000

  • Shanghai, China
View GitHub Profile
#!/bin/bash
cd ~
git clone https://github.com/xuyuji9000/dotfile.git .dotfile
source ~/.dotfile/setup.sh
vim
{
"ResourceRecords": [
{
"Value": "13.124.193.69"
}
],
"Type": "A",
"Name": "swarm.yogiman.cn.",
"TTL": 60
},
#!/bin/bash
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@xuyuji9000
xuyuji9000 / encoding_conv.js
Created May 26, 2017 02:19
JS string encoding convert, with iconv-lite and jschardet.
const reader = new FileReader()
const file = this.uploadInput.files[0]
let self = this
reader.onload = function()
{
let target_data = ''
const data_info = jschardet.detect(reader.result)
if('ascii'==data_info.encoding && data_info.confidence > 0)
target_data = this.result
else
let _ = require('lodash')
let thing = [
{"a": 123},
{"a": 456},
{"abc": 6789},
]
console.log(typeof(thing))
let result = _.filter(thing, function(element){
let _ = require('lodash')
let thing = [
{"a": 123},
{"a": 456},
{"abc": 6789},
]
console.log(typeof(thing))
let result = _.pickBy(thing, function(value, key){
let _ = require('lodash')
var data = [{
"name": "jim",
"color": "blue",
"age": "22"
}, {
"name": "Sam",
"color": "blue",
"age": "33"
@xuyuji9000
xuyuji9000 / createReactClass.jsx
Created May 8, 2017 12:32
A demo showcase how to use create-react-class to create react component.
let TickTock = createReactClass({
componentDidMount: function()
{
// fetch data action here
},
render: function()
{
return (
<div>
render the class
<?php
include_once(realpath(__DIR__ . '/vendor/autoload.php'));
Predis\Autoloader::register();
$client = new Predis\Client([
'scheme' => 'tcp',
'host' => '127.0.0.1',
'port' => 6379,
{
"require": {
"slim/slim": "^3.7",
"slim/php-view": "^2.2",
"bryanjhv/slim-session": "^3.0",
"illuminate/database": "^5.4",
"vlucas/phpdotenv": "^2.4",
"monolog/monolog": "^1.22",
"deployer/deployer": "^4.2",
"tuupola/slim-jwt-auth": "^2.3"