Skip to content

Instantly share code, notes, and snippets.

View paranoidjk's full-sized avatar

paranoidjk paranoidjk

View GitHub Profile
@paranoidjk
paranoidjk / setup-dev.sh
Created December 22, 2015 11:44
Install homebrew, nginx, mysql, php55, and composer on Mac OS X
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
@paranoidjk
paranoidjk / formComponent.js
Created January 22, 2016 06:26 — forked from arqex/formComponent.js
10.nonFunctionalReact
var MyForm = React.createClass({
render: function(){
return (
<ValidationForm ref="form" onSubmit={ this.validates }>
<Input name="title" validation="required" />
<Input name="age" validation="required,number" />
<Input name="email" validation={ value => value.match(/\S+@\S+\.\S+/) } />
</ValidationForm>
);
},
@paranoidjk
paranoidjk / Package Control.sublime-settings
Created January 25, 2016 12:54 — forked from nick1m/Package Control.sublime-settings
Sublime Text 3 There are no packages available for installation
# Сначала оказалось, что лежал сайт (в конце ответа лежит решение позволяющее обойти и эту проблему),
# проверяем https://packagecontrol.io/channel_v3.json, но и после возобновления проблема не ушла.
# Добавляем в настройки плагинов для пользователя (Preferences > Package Settings > Package Control > Settings - User) каналы:
"channels":
[
"https://packagecontrol.io/channel_v3.json",
"https://web.archive.org/web/20160103232808/https://packagecontrol.io/channel_v3.json",
"https://gist.githubusercontent.com/nick1m/660ed046a096dae0b0ab/raw/e6e9e23a0bb48b44537f61025fbc359f8d586eb4/channel_v3.json"
import requests
from db import db
"""
The Douban Group API which not display on http://developers.douban.com/wiki/?title=api_v2
Base url: https://api.douban.com/v2
Group info: /group/:id
@paranoidjk
paranoidjk / ga.php
Created February 14, 2016 05:43
自动更新VPN密码到Keychain
<?php
error_reporting(0);
$key = strtoupper($argv[1]);
$lut = array(
'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3,
'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7,
'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11,
@paranoidjk
paranoidjk / JS-Regular.html
Created February 25, 2016 02:51 — forked from lbj96347/JS-Regular.html
JS正则提取字符串/中文/英文/数字
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>javaScript正则表达式提取字符串中字母、数字、中文</title>
</head>
<body>
<input type="text" id="oText" value="李秉骏的常用代号是96347,英文名字是CashLee噢" size=100><br/>
<input type="button" value="number" onclick="get_character_you_want(this);">
@paranoidjk
paranoidjk / hasOwnProperty.js
Created September 1, 2016 02:08 — forked from jimeh/hasOwnProperty.js
Cross-browser hasOwnProperty solution
/*
Cross-browser hasOwnProperty solution, based on answers from:
http://stackoverflow.com/questions/135448/how-do-i-check-to-see-if-an-object-has-an-attribute-in-javascript
*/
if ( !Object.prototype.hasOwnProperty ) {
Object.prototype.hasOwnProperty = function(prop) {
var proto = this.__proto__ || this.constructor.prototype;
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
};
}