Skip to content

Instantly share code, notes, and snippets.

View xiongxin's full-sized avatar
:bowtie:
Let It Go

熊鑫 xiongxin

:bowtie:
Let It Go
View GitHub Profile
@xiongxin
xiongxin / routes.ex
Last active August 29, 2015 14:02
rails routes with admin for posts
resources "/posts",only: [:show]
scpco "/admin" do
resources "/posts",except: [:show]
end
@xiongxin
xiongxin / curd.ex
Last active August 29, 2015 14:08
elixir phoenix curd模板文件
defmodule PhoenixJobs.JobController do
use Phoenix.Controller
alias PhoenixJobs.Repo
alias Phoenix.Controller.Flash
alias PhoenixJobs.Queries
alias PhoenixJobs.Router.Helpers
plug :action
def index(conn, _params) do
@xiongxin
xiongxin / war.exs
Last active August 29, 2015 14:10 — forked from MonkeyIsNull/war.exs
defmodule Die do
def init(), do: :random.seed(:erlang.now)
def d6(), do: :random.uniform(6)
def d100(), do: :random.uniform(100)
end
defmodule War do
def create_player(name, skill, hp) do
[ name: name, skill: skill, hp: hp ]
end
@xiongxin
xiongxin / metadata.dart
Last active October 26, 2015 07:58
Retrieve metadata in Dartlang
// Dart VM version: 1.13.0-dev.7.3 (Fri Oct 23 04:20:51 2015) on "windows_x64"
// https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartmirrors---reflection
// http://stackoverflow.com/questions/19492607/how-to-retrieve-metadata-in-dartlang
import 'dart:mirrors';
class todo {
final String who;
final String what;
const todo(this.who, this.what);
@xiongxin
xiongxin / client.nim
Created February 25, 2016 13:10
nim sockets
import net
import rawsockets
import strutils
const SERVER_PORT = Port(1987)
const SERVER_ADDR = "localhost"
var canQuit = false
proc main() =
@xiongxin
xiongxin / list.html
Last active August 9, 2016 03:41
列表分页前端代码
<!DOCTYPE html>
<html lang="zh-CN"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{$name} - 百合花俱乐部</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
<meta content="telephone=no" name="format-detection">
<link href="{MAIQUAN_LILY_STATIC}style/reset.css" rel="stylesheet">
<link href="{MAIQUAN_LILY_STATIC}style/main.css" rel="stylesheet">
<link href="{MAIQUAN_LILY_STATIC}style/weui.css" rel="stylesheet">
@xiongxin
xiongxin / bs.dart
Last active October 9, 2019 18:52
Angular Dart ViewChild ContentChild example
import 'dart:html';
import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';
@Component(
selector: 'child-directive',
template: '<p>child</p>'
)
@xiongxin
xiongxin / regex_example.txt
Created January 13, 2018 03:52 — forked from kiinlam/regex_example.txt
正则匹配
正则匹配
匹配中文字符的正则表达式: [\u4e00-\u9fa5]
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了
匹配双字节字符(包括汉字在内):[^\x00-\xff]
评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)
匹配空白行的正则表达式:\n\s*\r
评注:可以用来删除空白行
@xiongxin
xiongxin / 步骤.md
Last active August 14, 2018 09:59
Elasticsearch建表步骤

建表mapping

PUT /spider_amazon_product_monitor

{
   "JSON文件"
}

插入一条数据

@xiongxin
xiongxin / rust编译器windows安装步骤.md
Created August 23, 2018 03:22
rust编译器windows安装步骤

window10安装使用msvc报错问题,所以选择gnu编译器

  1. rustup toolchain install stable-x86_64-pc-windows-gnu
  2. rustup default stable-gnu