Skip to content

Instantly share code, notes, and snippets.

View yosevu's full-sized avatar

Yosevu Kilonzo yosevu

View GitHub Profile
//7
function countVowels(string) {
var letters = string.split('');
var vowels = "aeiou";
var vowelIndex;
var vowel;
var vowelCount = 0;
var i = 0;
while (i < vowels.length) {
@yosevu
yosevu / gist:bb72c0b5d281af3b439576d253226fa8
Created October 29, 2016 03:37
bloccit-rails-console-assignment
4. [10] pry(main)> post = Post.first
Post Load (0.7ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
=> #<Post:0x0000000363e180
id: 1,
title: "First Post",
body: "This is the first post in our system",
created_at: Sat, 29 Oct 2016 02:26:21 UTC +00:00,
updated_at: Sat, 29 Oct 2016 02:26:21 UTC +00:00>
@yosevu
yosevu / lambda-not-anon.md
Created May 22, 2017 00:58
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@yosevu
yosevu / introrx.md
Created May 25, 2017 18:35 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@yosevu
yosevu / basic.md
Created July 21, 2017 12:40 — forked from zenorocha/basic.md
New Firebase Auth vs Old Firebase Auth
@yosevu
yosevu / manifest.json
Last active August 8, 2017 01:00
manifest
{
"manifest_version": 2,
"name": "React Content Script",
"version": "0.1",
"description": "React Content Script",
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["/static/css/main.css"],
"js": ["/static/js/main.js"]
@yosevu
yosevu / App.js
Created August 8, 2017 02:56
App
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src="https://facebook.github.io/react/img/logo.svg" className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
.App {
text-align: center;
margin: 70px auto;
width: 50%;
}
// Other styles
@yosevu
yosevu / index.js
Last active August 8, 2017 12:51
Index
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
// Get the element to prepend our app to from https://www.google.com.
// This could be a specific element on a website or something more general like `document.body`.
const viewport = document.getElementById('viewport');
// Create a div to render the App component to.
@yosevu
yosevu / nested-quote-feeds.js
Created September 5, 2017 16:58
Nested Quote Feeds
const quoteFeeds = [
{
id: 'feed1',
name: 'Programming',
quotes: [
{
id: 'quote1',
text:'Every great developer you know got there by solving problems they were unqualified to solve until they actually did it.',
source: 'Patrick McKenzie',
liked: false