Skip to content

Instantly share code, notes, and snippets.

View kevgathuku's full-sized avatar

Kevin Gathuku kevgathuku

View GitHub Profile
@kevgathuku
kevgathuku / linux-setup.sh
Created May 18, 2024 16:57 — forked from dhh/linux-setup.sh
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@kevgathuku
kevgathuku / dummy_controller.rb
Created August 9, 2022 06:51 — forked from psobocinski/dummy_controller.rb
Asserting on a JSON response in a Rails controller test with MiniTest
class DummyController < ApplicationController
def do
render json: { balance: 50 }
end
end
@kevgathuku
kevgathuku / how-to-add-image-to-gist.md
Last active June 21, 2022 08:17 — forked from mroderick/how-to-add-image-to-gist.md
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone [email protected]:<hash>.git     # or with ssh
@kevgathuku
kevgathuku / yarn.config
Created May 14, 2021 12:16 — forked from sealocal/yarn.config
Install Yarn and NodeJS on AWS Elastic Beanstalk EC2 Instance with Amazon Linux Ruby Platform, prior to precompiling assets for a Rails app
files:
# If this file is edited, it must be removed from EC2 instance prior to deploy.
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
set -xe
@kevgathuku
kevgathuku / iframechange.js
Created October 3, 2019 06:08 — forked from hdodov/iframechange.js
HTML iframe URL change listener for tracking when a new iframe page starts to load
function iframeURLChange(iframe, callback) {
var lastDispatched = null;
var dispatchChange = function () {
var newHref = iframe.contentWindow.location.href;
if (newHref !== lastDispatched) {
callback(newHref);
lastDispatched = newHref;
}
@kevgathuku
kevgathuku / EventComponent.spec.js
Created November 5, 2018 19:22 — forked from hartzis/EventComponent.spec.js
Touch Event Testing React Jest Enzyme
import React from 'react';
import EventComponent from './EventComponent';
import { mount } from 'enzyme';
import {
createStartTouchEventObject,
createMoveTouchEventObject
} from './EventHelpers.js';
describe('EventComponent', () => {
@kevgathuku
kevgathuku / Main.elm
Created October 1, 2018 16:37 — forked from sch/Main.elm
Minimum Elm boilerplate
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
type alias Model =
{ count : Int }
@kevgathuku
kevgathuku / circleci-heroku-continuous-deployment2.0.md
Created August 5, 2018 18:26 — forked from lauraturk/circleci-heroku-continuous-deployment2.0.md
instructions for deploying from circleci2.0 to heroku
@kevgathuku
kevgathuku / sort.ex
Created June 18, 2018 10:37 — forked from rylev/sort.ex
Sort Algorithms in Elixir
## Sort Algorithms in Elixir
# Selection Sort
defmodule Selection do
def sort(list) when is_list(list) do
do_selection(list, [])
end
def do_selection([head|[]], acc) do
@kevgathuku
kevgathuku / api.js
Created May 23, 2018 19:53 — forked from pshoukry/api.js
React / Redux fetch from rails server with CSRF token
import _ from 'underscore';
import fetch from 'isomorphic-fetch'
class API {
getCSRFToken() {
return _.find(document.getElementsByTagName('meta'), (meta) => {
return meta.name === 'csrf-token'
}).content
}