Skip to content

Instantly share code, notes, and snippets.

View ruyaoyao's full-sized avatar
❣️

Shiny ruyaoyao

❣️
View GitHub Profile
@ruyaoyao
ruyaoyao / 0-model-override.js
Created November 4, 2016 01:41 — forked from spencermefford/0-model-override.js
An alternative to extending Loopback's built in models. In our application, we wanted to create a custom role called "ecm-administrator" that would have the ability to create and manage users.
module.exports = function (app) {
var _ = require('lodash');
var User = app.models.User;
var Role = app.models.Role;
var RoleMapping = app.models.RoleMapping;
var ACL = app.models.ACL;
/*
* Configure ACL's
*/
@ruyaoyao
ruyaoyao / helpers.js
Created November 4, 2016 02:39
Disable selected remote methods on Loopback
module.exports.disableAllMethods = function disableAllMethods(model, methodsToExpose)
{
if(model && model.sharedClass)
{
methodsToExpose = methodsToExpose || [];
var modelName = model.sharedClass.name;
var methods = model.sharedClass.methods();
var relationMethods = [];
var hiddenMethods = [];
@ruyaoyao
ruyaoyao / common.yml
Created February 2, 2017 08:11 — forked from akurkin/common.yml
ROSI docker-compose.yml
#
# Shared definition of ruby microservice
#
microservice:
command: "runsvdir /etc/service"
environment:
PORT: 3000
RAILS_ENV: development
SERVICE_PLATFORM: "mia"
ports:
@ruyaoyao
ruyaoyao / README
Created February 23, 2017 05:42 — forked from adilapapaya/README
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.
@ruyaoyao
ruyaoyao / parseLodash.js
Created April 28, 2017 03:22 — forked from gucheen/parseLodash.js
Safe JSON.parse with lodash.js
function parseLodash(str){
return _.attempt(JSON.parse.bind(null, str));
}
@ruyaoyao
ruyaoyao / index.html
Last active May 23, 2017 02:20
CSS 垂直置中解法, Making element to align vertically. JS Bin// source http://jsbin.com/dunutiwone
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<style id="jsbin-css">
.ot {
width: 400px;
height: 400px;
border: 1px solid #FF6600;
@ruyaoyao
ruyaoyao / index.html
Created May 23, 2017 02:20
多行文本未知高度垂直居中-by一丝 // source http://jsbin.com/xowiyuw
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>多行文本未知高度垂直居中-by一丝</title>
<style id="jsbin-css">
*{margin:0;padding:0;}
.box{
height:200px;
@ruyaoyao
ruyaoyao / lopmonhoc.js.jsx
Created July 15, 2017 13:41 — forked from revskill10/lopmonhoc.js.jsx
Integrate Datatable with React.js
/** @jsx React.DOM */
var LopMonHoc = React.createClass({
getInitialState: function(){
return {data: []}
},
loadData: function(){
$.ajax({
url: '/daotao/lops',
success: function(data){
@ruyaoyao
ruyaoyao / ClientApp.jsx
Created July 20, 2017 14:50 — forked from btholt/ClientApp.jsx
react-router server-side rendering
const React = require('react')
const Landing = require('./Landing')
const Search = require('./Search')
const Layout = require('./Layout')
const Details = require('./Details')
const ReactRouter = require('react-router')
const data = require('../public/data')
const { Router, Route, hashHistory, IndexRoute } = ReactRouter
const Store = require('./Store')
const { store } = Store
@ruyaoyao
ruyaoyao / index.js
Created October 12, 2017 07:40 — forked from miguelmota/index.js
Node.js Winston logger wrapper to display filename
var log = require('./lib/logger')(module);
log.info('foo');