I made use of fetch API(A browser based request API, LOL). You can replace with any of your choice :)
class Slider extends React.Component { | |
state = { | |
index: 0 | |
}; | |
invokeInterval = () => { | |
this.setState({ | |
index: |
; Program to wish an unknown user a happy birthday | |
section .text | |
global _start | |
_start: | |
; write | |
mov eax, 4 | |
mov ebx, 1 ;std_out | |
mov ecx, msg |
; Program to add two numbers | |
section .text | |
global _start | |
_start: | |
; handles the first input | |
mov eax, 4; write | |
mov ebx, 1; std_out | |
mov ecx, msg1; what to write |
def count_words(w, n): | |
words = [] | |
s = list(set(w.split())) | |
s.sort() | |
for word in s: | |
words.append((word, w.split().count(word))) | |
words.sort(key = lambda x: (x[1]), reverse = True) | |
import React, { Component } from 'react'; | |
export default function(ComposedComponent) { | |
class Auth extends Component { | |
static contextTypes = { | |
router: React.PropTypes.object | |
} | |
componentWillMount() { | |
if (!localstorage.token) { |
What i wanted to do was serve our stylesheet as a link on next's document head based on the current route but there're Lots and lots of complications 😄, using gulp to do the transformation from sass to css before publishing to production. I'll just leave the incomplete solution i proposed tho and wait for nextjs's official solution to global css cos i don't buy the idea of css in js
😏 Let;s see how that goes tho while i use this approach on my personal website
Math.random()
generates series of decimal numbers from 0(inclusive) to 1(not inclusive). So we can have numbers like 0.21724877044031787, 0.814708270731549 and so on.
So, we need to convert these numbers to whole numbers in a specified range. We'd pick 3 to 7 here.
How can we do that ? 💭💭💭
We need to multiply the random number with a number. I know it might not sound so cool, like "why not just multiply it with 2 or 5 or 7", but it's a lot more than that because we need the number to be in the specified range.
And that number actually is (MAX - MIN + 1) + MIN
= (7 - 3 + 1) + 3
/** @jsx React.DOM */ | |
var MyRootComponent = React.createClass({ | |
getInitialState: function() { | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
var socket = io.connect(this.props.url); | |
socket.on('business.clickout', this.setState.bind(this)); | |
}, | |
render: function() { |