Skip to content

Instantly share code, notes, and snippets.

Avatar
☯️

m.b. mbajur

☯️
View GitHub Profile
@mbajur
mbajur / Gemfile
Last active May 27, 2020
Liquid, Handlebars, Erb and gsub benchmarks
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'liquid'
gem 'ruby-handlebars'
@mbajur
mbajur / update_production
Created Nov 13, 2018
Prismo updating script
View update_production
echo '== Stoping the app =='
docker-compose down
echo '== Pulling changes =='
git pull
echo '== Building the image =='
docker-compose build
echo '== Removing old assets'
@mbajur
mbajur / affix.vue
Created Jul 20, 2017
vue-affix with option to delay the initialization
View affix.vue
<template>
<div>
<slot></slot>
</div>
</template>
<script>
export default {
props: {
/**
View The view
module Api::Views::V1::Events
class Index
include Api::View
end
@mbajur
mbajur / alt-action-listeners.js.es6
Last active Jun 28, 2017
alt.js - listening for events outside of the store
View alt-action-listeners.js.es6
/**
* ActionListeners(alt: AltInstance): ActionListenersInstance
*
* > Globally listen to individual actions
*
* If you need to listen to an action but don't want the weight of a store
* then this util is what you can use.
*
* Usage:
*
@mbajur
mbajur / letsencrypt.md
Created May 9, 2016 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth
View letsencrypt.md

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@mbajur
mbajur / .md
Created Apr 29, 2016
How to create small, unique tokens in Ruby
View .md

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

View gist:d65c92445f48603424e7

(important) Setup ubuntu to use aufs driver for drone

sudo apt-get install linux-image-extra-$(uname -r)
sudo reboot

Install docker

curl -s https://get.docker.io/ubuntu/ | sudo sh

Install drone.io

@mbajur
mbajur / README.md
Created Jun 27, 2014
Add git branch name to terminal prompt (mac)
View README.md

Open up your bash profile file with

vim ~/.bash_profile

and at the end of that file, add:

# Git branch in prompt.
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
You can’t perform that action at this time.