Skip to content

Instantly share code, notes, and snippets.

View haochuan's full-sized avatar
🏀
Wooo

_haochuan haochuan

🏀
Wooo
View GitHub Profile
pub fn run() {
let contents = read_to_string("test-package.json").expect("Failed to read json file");
println!("{}", contents);
let indent = detect_indent::detect_indent(&contents);
let is_end_with_newline = contents.ends_with('\n');
let mut v: serde_json::Value =
serde_json::from_str(&contents).expect("Failed to parse json file");
println!("{:?}", v);
if let Some(map) = v.as_object_mut() {
@haochuan
haochuan / form.js
Created April 13, 2016 22:47
React Component import/export
// form.js and home.js are in the same dir
// If ES5, var Home = React.createClass({....})
class Form extends Component {
// If ES5, do not need this
constructor(props, contexts) {
super(props, contexts);
}
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">