Skip to content

Instantly share code, notes, and snippets.

View DanielZhangQingLong's full-sized avatar
🎯
Focusing

Daniel DanielZhangQingLong

🎯
Focusing
View GitHub Profile
import EventEmitter from '../event_emitter'
// Simulate a store. In real world, this should be an API request.
const Seniors = {
"1": {
url: "http://photocdn.sohu.com/20140811/Img403316505.jpg"
},
"2": {
url: "http://photocdn.sohu.com/20140811/Img403316505.jpg"
}
import React, { Component } from 'react';
import SeniorStore from '../store/seniors.db';
import Senior from './senior';
import PlusOneSecond from './plus_one_second';
import SeniorDispatcher from '../dispatchers/senior_dispatcher';
export default class SeniorList extends Component {
state = {
seniors: SeniorStore.fetchAllSeniors()
import Dispatcher from '../dispatcher';
import SeniorStore from '../store/seniors.db';
const SeniorDispatcher = new Dispatcher();
SeniorDispatcher.register(function(action){
switch(action.actionType) {
case 'PLUS1S': {
console.log('PLUS1S');
SeniorStore.plus1s(action.url);
@DanielZhangQingLong
DanielZhangQingLong / dispatcher.js
Created April 27, 2018 14:56
dispatcher for flux
export default class Dispatcher {
constructor() {
//this._id = 0;
// Store add all the reducers.
this._callbacks = [];
}
register(callback) {
// key is a timestamp, value is the callback
export default class EventEmitter {
constructor() {
this._events = {};
}
// Add typed listeners e.g. change: [listeners...]
on(type, listener) {
this._events[type] = this._events[type] || [];
// The structure _events is {type: [], type2: []}
// Only push it into the array not invoke.
@DanielZhangQingLong
DanielZhangQingLong / web-fonts-asset-pipeline.md
Created April 9, 2018 09:14 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

I run the command "rake eol:db:recreate RAILS_ENV=development"
and It happends
rake aborted!
Permission denied - /home/u/eol/db/structure.sql
how can I solve the problem.