Skip to content

Instantly share code, notes, and snippets.

View fayimora's full-sized avatar
🕺

Fayi FB fayimora

🕺
  • London, England
View GitHub Profile
@fayimora
fayimora / tracker-list.txt
Created February 11, 2024 23:04 — forked from FFY00/tracker-list.txt
Torrent Trackers
http://104.28.1.30:8080/announce
http://104.28.16.69/announce
http://107.150.14.110:6969/announce
http://109.121.134.121:1337/announce
http://114.55.113.60:6969/announce
@fayimora
fayimora / components.hider-component.js
Last active April 18, 2017 14:21 — forked from courajs/components.hider-component.js
Conditionally rendered components
import Ember from 'ember';
import through from '../indirect';
// Inlined, since no addons in twiddles. Really use this:
// import through from 'ember-computed-indirect/utils/indirect';
export default Ember.Component.extend({
user: Ember.inject.service('user-permissions'),
flagName: '', // specify in extending component
flagPath: Ember.computed('flagName', function() {
return 'user.permissions.' + this.get('flagName');

I think the better approach is to know what is a Functor before asking about Monads.

A Functor is a Higher Kinded Type/Type Constructor/Function at the type level that has a certain shape (that is, it implements a map function). A Functor is also what's known as a typeclass. A Monad is also a typeclass

Typeclasses are a form of ad-hoc polymorphism that let you add functionality to existing code that you may or may not have written.

Here's is the basic definition of a Functor

trait Functor[F[_]] {
 def map[A, B](fa: F[A])(f: A => B): F[B]
@fayimora
fayimora / controllers.application.js
Created November 10, 2016 22:17 — forked from poteto/controllers.application.js
ember-changeset-validations demo
import Ember from 'ember';
import AdultValidations from '../validations/adult';
import ChildValidations from '../validations/child';
import { reservedEmails } from '../validators/uniqueness';
import { schema } from '../models/user';
const { get } = Ember;
const { keys } = Object;
export default Ember.Controller.extend({
@fayimora
fayimora / gist:1684e834e853c95a1b7b
Created February 21, 2016 00:15 — forked from neciu/gist:6bfeab3e3ae38638d8fb
Added hax enabling auto filing from existing models/properties.

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

@fayimora
fayimora / android_lexer.rb
Created February 18, 2016 10:54 — forked from maxlinc/android_lexer.rb
Workaround for java vs android in slate
require 'rouge'
module Rouge
module Lexers
class Android < Rouge::Lexers::Java
tag 'android'
end
end
end
{
import javax.sound.midi._
val synth = MidiSystem.getSynthesizer()
synth.open()
def note(i: Int) = {
val channels = synth.getChannels()
channels(0).noteOn(i, 100)
Thread.sleep(250)
channels(0).noteOff(i)
}
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
def stochastic_linear_gradient_descent(X, y, theta, alpha, tolerance):
converged = False
prev_cost = 0
n_samples = X.shape[0]
while not converged:
# use xrange so you dont have to generate the entire range of numbers
for i in xrange(n_samples):
# you have to sample x and y together
# FYI, using one example at a time can be super slow.
# you might want to consider using batches which should converge quicker
@fayimora
fayimora / HMM.jl
Last active August 29, 2015 14:12 — forked from sbos/HMM.jl
module HMM
using Distributions
import Distributions.rand
import Distributions.fit
immutable HiddenMarkovModel{TP, K}
theta::Vector{TP}
A::Matrix{Float64}