Skip to content

Instantly share code, notes, and snippets.

View AllenFang's full-sized avatar
🇹🇼
I may be slow to respond.

allen AllenFang

🇹🇼
I may be slow to respond.
View GitHub Profile
angular.module("demoApp", ['ng.bs.dropdown'])
.controller("YearController", function($scope){
$scope.years = [
"2015",
"2014",
"2013",
"2012",
"2011",
"2010"
];
var React = require("react"); //use require(module_name) to load module.
React.render(
<p>Hello, World!</p>,
document.getElementById('hello')
);
@AllenFang
AllenFang / app.js
Last active August 29, 2015 14:16
Blogger for angularjs pangation
angular.module("demoApp", [])
.controller("ProductController", function($scope){
$scope.currPage = 3;
$scope.numPerPage = 5;
$scope.products = [];
for(var i=0;i<50;i++){
$scope.products[i] = "Product " + i;
}
$scope.changeProduct = function(){
language: node_js
node_js:
- "0.10.25"
env:
- NODE_ENV=travis
before_install:
- sudo npm install bower -g
- bower install
- sudo chown -R $(whoami) /home/shippable/.npm
after_success:
angular.module("demoApp", [])
.directive("productContainer", function(){
return{
scope:{
data: "="
},
templateUrl: "productsTemplate.html",
link: function(scope, el, attr){
// splitSize 表示每列有幾個 product
scope.splitSize = parseInt(attr["splitSize"]);
var React = require("react");
var Content = React.createClass({
render: function(){
return(
<div>{this.props.value}</div>
)
}
});
import React from 'react';
export default React.createClass({
render() {
return (
<div>Current value: {this.props.count}</div>
)
}
});
@AllenFang
AllenFang / gulpfile-basic.js
Last active August 29, 2015 14:17
browserify and watchify
gulp.task("build", function(){
//building your app.
});
gulp.task("dev", function(){
gulp.watch("./src/app.js", ['build']);
});
// preprocessor.js
var ReactTools = require('react-tools');
module.exports = {
process: function(src) {
return ReactTools.transform(src, {
harmony:true
});
}
};
@AllenFang
AllenFang / DemoApp.js
Last active October 28, 2016 07:00
programmatically select row on react-bootstrap-table
var React = require('react');
var ReactBsTable = require('react-bootstrap-table');
var BootstrapTable = ReactBsTable.BootstrapTable;
var TableHeaderColumn = ReactBsTable.TableHeaderColumn;
var DemoApp = React.createClass({
getInitialState: function () {
/*
segments is a simple data for table
selected is mean that selected row on table. default is empty
*/