Skip to content

Instantly share code, notes, and snippets.

View noname007's full-sized avatar
🐢
I may be slow to respond.

soul11201 noname007

🐢
I may be slow to respond.
View GitHub Profile
@noname007
noname007 / singletone.php
Created February 11, 2015 09:10
php 单例模式代码-----
class Singletone{
private static $obj=null;
private function __construct(){}
static function getInstance()
{
if(is_null(self::$obj))
{
echo 111111111,'------';
@noname007
noname007 / autoload.php
Last active August 29, 2015 14:16
spl_autoload_register类的自动加载
<?php
function import($classname)
{
$filename = __DIR__.'/class/'.$classname.'.php';
if(is_file($filename))
{
require $filename;
}else {
die('Not Find the file '.$filename);
}
@noname007
noname007 / _.md
Last active August 29, 2015 14:17 — forked from klange/_.md

Since this is on Hacker News...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later).
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • They're all while loops because shut up, you're overthinking a joke.
@noname007
noname007 / render.php
Created March 25, 2015 08:37
sql-table->html-table
<?
function render($rows)
{
$str = '<table border="1">';
foreach ($rows as $row) {
$str .='<tr>';
foreach ($row as $key => $value) {
$str .= '<td bgcolor="silver">'.$key.'</td><td>'.$value.'</td>';
}
$str .= '</tr>';
@noname007
noname007 / read_cmd_input.php
Last active August 29, 2015 14:19
程序运行时从命令行读取数据. read data from cmd while running.
<?php
function read_cmd_input($rule_read_cmd = array())
{
if(empty($rule_read_cmd))
$rule_read_cmd = array('yes'=>1,'no'=>0);/*结束读取的操作,及对应的返回值*/
$cmd = '';
$fh = fopen('php://stdin','r');
$rule_read_cmd_key = array_keys($rule_read_cmd);
$rule_read_cmd_str = join(',',$rule_read_cmd_key);
echo 'Please input [',$rule_read_cmd_str,']:';
p = print
local mt ={}
local _t = {}
local mt_t = {}
mt.__newindex = _t
mt_t.__newindex = function(t,k,v)
@noname007
noname007 / active.md
Created October 20, 2015 03:13 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sat, 04 Oct 2014 19:10:54 GMT till Sun, 04 Oct 2015 19:10:54 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 474)
@noname007
noname007 / nginx.conf
Created October 30, 2015 11:52
NGINX-RTMP push to Twitch and Hitbox
#user nobody;
worker_processes 1;
error_log logs/rtmp_error.log debug;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs/nginx.pid;
@noname007
noname007 / ks.signature.php
Last active December 31, 2015 04:06
金山 直播 签名生成
<?php
$_param['accesskey'] = KS_AK;
$_param['expire'] = time()+3*3600;
$_param['method'] = 'add';
$_param['app'] = 'appappapp';
$_param['name'] = 'test';
$_param['nonce'] = uniqid();
$_param['public'] = 1;
$_param['vdoid'] = 1;