Skip to content

Instantly share code, notes, and snippets.

View kofiasare's full-sized avatar
🎯
Focusing

Kofi Asare kofiasare

🎯
Focusing
View GitHub Profile
@kylev
kylev / Dockerfile
Last active September 21, 2022 00:43
A complete Alpine docker-compose Rails workflow with PostgreSQL and Redis
FROM ruby:2.6-alpine
# Additional runtime facilities provided by the OS.
RUN apk add --no-cache libxml2 libxslt postgresql-libs tzdata
# Tell bundler how to use the OS.
RUN gem install bundler -v '~> 1.17' && \
bundle config build.nokogiri --use-system-libraries
WORKDIR /opt/app
RUN mkdir -p tmp/pids tmp/cache
@munkiepus
munkiepus / install_mailcatcher.sh
Last active February 25, 2022 16:40
install mailcatcher with systemd init script on ubuntu 18.04 and catch all sendmail
#!/bin/bash
echo "-- installing mailcatcher -- "
apt-get install ruby ruby-dev ruby-all-dev sqlite3 libsqlite3-dev -y
gem install mailcatcher
echo '[Unit]
Description = MailCatcher
@nemanja947
nemanja947 / NprogressAxios.js
Last active October 7, 2023 01:44
NProgress implementation with Axios
// Add a request interceptor
axios.interceptors.request.use(function (config) {
// Do something before request is sent
NProgress.start();
return config;
}, function (error) {
// Do something with request error
console.error(error)
return Promise.reject(error);
});
@vaz
vaz / vagrant-fixes-for-watch-polling.md
Last active October 31, 2020 12:50
Various fixes for file-watching and live-reloading when running servers in Vagrant

Vagrant fixes for file-watching servers

These snippets show how to enable polling for filesystem changes when using

  • nodemon for Node apps (ExpressJS, etc)
  • rails server
  • webpack-dev-server --watch
  • ember server

You can probably look at these examples and Google to find similar solutions for other dev servers.

@JesterXL
JesterXL / promiseall.js
Last active October 31, 2022 16:02
Example of using Array Destructuring for Promise.all.
Promise.all([
someThingThatReturnsAPromise(),
otherThingThatReturnsAPromise(),
lastThingThatReturnsAPromise()
])
.then( results =>
{
// this...
const [first, second, third] = results;
// ... instead of
@Brainiarc7
Brainiarc7 / xclip-copy-to-clipboard.md
Created April 26, 2017 17:53
Using xclip to copy terminal content to the clip board on Linux

Using xclip to copy terminal content to the clip board:

Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.

For the mouse clipboard, pipe straight to xclip:

echo 123 | xclip

For the system clip board, pipe to xclip and select clip directly:

@hootlex
hootlex / Component.vue
Created December 8, 2016 00:47 — forked from nickbasile/Component.vue
How to use a namespaced action in a Vue.js component
<template>
<div>
<button @click="increment">Increment</button>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default{
methods: {
@stevemolloy
stevemolloy / numbers.ex
Last active December 13, 2021 18:26
Prime numbers in Elixir
defmodule Numbers do
def prime?(2), do: :true
def prime?(num) do
last = num
|> :math.sqrt
|> Float.ceil
|> trunc
notprime = 2..last
|> Enum.any?(fn a -> rem(num, a)==0 end)
@maxivak
maxivak / 00.md
Last active April 8, 2025 18:31
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@santiaago
santiaago / cache.go
Last active June 24, 2023 18:24
Learning HTTP caching in Go
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"