Skip to content

Instantly share code, notes, and snippets.

@ooade
ooade / Carousel.js
Last active April 3, 2019 22:19
Carousel / Slider
@ooade
ooade / birthday.asm
Created February 3, 2018 10:36
Program to wish unknown users happy birthday
; 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
@ooade
ooade / sum.asm
Last active June 23, 2021 10:31
Add Two numbers in Assembly language
; 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
@ooade
ooade / count_words.py
Created November 22, 2017 06:51
Udacity ML
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)
@ooade
ooade / README.md
Last active April 13, 2017 16:49
Grab posts from subreddit

I made use of fetch API(A browser based request API, LOL). You can replace with any of your choice :)

@ooade
ooade / hoc-w.js
Last active April 6, 2017 11:32
hoc in react with react-redux
import React, { Component } from 'react';
export default function(ComposedComponent) {
class Auth extends Component {
static contextTypes = {
router: React.PropTypes.object
}
componentWillMount() {
if (!localstorage.token) {
@ooade
ooade / README.md
Last active March 11, 2017 19:11
Proposed NextCSS structure

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

@ooade
ooade / README.md
Last active March 11, 2017 19:16
Generating a Range of Whole Numbers Concept

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

@ooade
ooade / Sort.md
Created March 9, 2017 06:45
Sort Function

Sort function with side-effects; changes the original array

1

function arrangeNumbers(arr) {
   return arr.sort(function(a, b){
      return a - b;
   })
}
var arr = [4, 6, 1, 3, 7, 2];
/** @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() {