Skip to content

Instantly share code, notes, and snippets.

View kevgathuku's full-sized avatar

Kevin Gathuku kevgathuku

View GitHub Profile
@kevgathuku
kevgathuku / docker_kill.sh
Created February 13, 2018 09:43 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@kevgathuku
kevgathuku / uuid_url64.py
Created February 7, 2018 11:55 — forked from mattupstate/uuid_url64.py
Generate unique, URL friendly ID's based on UUID with Python
import re
import uuid
import base64
def uuid_url64():
"""Returns a unique, 16 byte, URL safe ID by combining UUID and Base64
"""
rv = base64.b64encode(uuid.uuid4().bytes).decode('utf-8')
return re.sub(r'[\=\+\/]', lambda m: {'+': '-', '/': '_', '=': ''}[m.group(0)], rv)
@kevgathuku
kevgathuku / requestAnimationFrame.js
Created August 17, 2017 19:47 — forked from jacob-beltran/requestAnimationFrame.js
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
;; try this form-by-form at a REPL
(require '[clojure.spec.alpha :as s])
;; create an inline DSL to describe the FizzBuzz world
(defmacro divides-by
[nm n]
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n)))))
;; specify FizzBuzz
(divides-by ::fizz 3)
@kevgathuku
kevgathuku / ID.js
Created August 14, 2017 22:40
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
import React from 'react';
import { Layer, Rect, Stage, Line, Circle, Group } from 'react-konva';
import Konva from 'konva';
import compose from 'recompose/compose';
import { connect } from 'react-redux';
import { addRectangle } from 'vclub/redux/club/whiteboard';
const enhance = compose(
@kevgathuku
kevgathuku / index.html
Created March 31, 2017 15:32
jQuery Number Counter
<h1>JQUERY NUMBER ANIMATION</h1>
<h3>jQuery counter to count up to a target number</h3>
<div class="wrapper">
<div class="counter col_fourth">
<i class="fa fa-code fa-2x"></i>
<h2 class="timer count-title count-number" data-to="300" data-speed="1500"></h2>
<p class="count-text ">SomeText GoesHere</p>
</div>
@kevgathuku
kevgathuku / frp.md
Created March 29, 2017 10:20 — forked from ohanhi/frp.md
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@kevgathuku
kevgathuku / gist:d9b8e3eb73fe64ca94e17e9d57272714
Created March 4, 2017 16:40 — forked from ngocdaothanh/gist:3764694
Scala Assignment: Recursion
package recfun
import scala.collection.mutable.ListBuffer
import common._
/** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
@kevgathuku
kevgathuku / front-end-curriculum.md
Created February 1, 2017 17:10 — forked from stevekinney/front-end-curriculum.md
Front-end Curriculum Draft

Module 1

  • Semantic markup
  • HTML standards mode and quirks mode
  • HTML fundamentals
    • Classes and IDs
  • CSS fundamentals
    • Selectors
    • Resets and normalizers
    • The box model