Skip to content

Instantly share code, notes, and snippets.

View wx_t1t_hack.js
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
View es6-ajax-request.js
export default class Ajax {
get(url, callback) {
let xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
xhr.open('GET', url);
xhr.onreadystatechange = () => {
if (xhr.readyState > 3 && xhr.status === 200) {
callback(xhr.responseText);
}
};
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
@jcouyang
jcouyang / react-tips.md
Last active Oct 24, 2015
some tips about React
View react-tips.md

React Tips

Prop Validation

如果把每个Component想象成一个函数,那么props就是这个函数的参数。在有类型检查的语言中,很容易在编译期间就可以对参数类型检 查来避免一些不必要的错误。

javascript没有类型检查,但是我们仍然能筒高React的Prop Validation在运行期间检查props的类型。

只需要在Component声明里加上

propTypes: {
@zinovyev
zinovyev / bootstrap
Last active Apr 29, 2018
Vagrant nginx & php-fpm bootstrap.sh
View bootstrap
#!/usr/bin/env bash
#
# Vagrant nginx & php-fpm
# Vagrant basic bootstrap.sh file configuration for getting a ready to use dev solution
#
# Ivan Zinovyev <vanyazin@gmail.com>
#
# (The "ubuntu/trusty64" box was used and tested)
#
View ipa.sh
#!/bin/bash
# unzip the .ipa file
unzip -q "$1"
# Default information
displayName=`/usr/libexec/PlistBuddy -c "Print CFBundleDisplayName" Payload/*/Info.plist`
bundleIdentifer=`/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" Payload/*/Info.plist`
versionName=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Payload/*/Info.plist`
@andreacremaschi
andreacremaschi / UITableView+Header
Last active Jun 28, 2020
UITableView category to resize table view header using autolayout
View UITableView+Header
UITableView convenience classes for resizing header and footer with autolayout.
View git_toturial
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@zaherg
zaherg / install.md
Last active Oct 18, 2020
a small tips to install latest nginx , php 5.5 & laravel 4.1 since that Laravel 4.1 has been released, i have removed the line which explain how to install laravel from dev branch using composer.
View install.md

Creating Your Laravel & nginx Server

We will install Larave 4.1 with PHP5.5 & Latest nginx on Ubuntu 12.04.3 x64.

updating your system

apt-get update && apt-get upgrade
adduser [username]
usermod -aG sudo [username]
apt-get -y install git
@jiguang
jiguang / random_color.html
Last active Dec 25, 2015
随机颜色,可控制深浅
View random_color.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
h1{font: bold 14px/1.5em \5FAE\8F6F\96C5\9ED1; color: #333;}
button{cursor: pointer;}
#opt{ margin-bottom: 15px;}
#opt label, #opt input{font: 12px/20px arial;}
#opt input{width: 40px; padding: 0 2px;}
@cloudsben
cloudsben / oauth2_lib.php
Created Oct 17, 2012
codeigniter新浪微博 SDK
View oauth2_lib.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* @ignore
*/
class OAuthException extends Exception {
// pass
}
class Oauth2_lib {