Skip to content

Instantly share code, notes, and snippets.

View diraulo's full-sized avatar
🧪
...

Raoul DIFFOUO diraulo

🧪
...
View GitHub Profile
@diraulo
diraulo / products_spec.rb
Created February 27, 2020 10:46
Sample GET request spec with custom headers
require 'rails_helper'
RSpec.describe Api::V1::ProductsController, type: :request do
describe 'GET#index' do
it 'list all products' do
# you can add more headers in that hash
headers = {
'ACCEPT' => 'application/json',
'CONTENT_TYPE' => 'application/json',
}
@diraulo
diraulo / delete_repos.rb
Last active July 6, 2019 13:06
Interactively delete forked repositories on GitHub
# frozen_string_literal: true
require "octokit"
require "awesome_print"
# Generate a token with delete_repo scope here https://github.com/settings/tokens/new
ACCESS_TOKEN = "your_personal_access_token"
begin
client = Octokit::Client.new(access_token: ACCESS_TOKEN)
@diraulo
diraulo / package.json
Created February 28, 2018 10:11
List of atom packages
[
{
"name": "about",
"version": "1.7.8"
},
{
"name": "aligner",
"version": "1.2.4"
},
{
@diraulo
diraulo / open_weather.rb
Created February 27, 2018 14:55
Open Weather API Ruby Demo
# Example using the net/http module of ruby - Remember to set your api_key in an .env file
require 'awesome_print'
require 'dotenv/load'
require 'json'
require 'net/http'
require 'pry-byebug'
api_key = ENV['OPENWEATHER_API_KEY']
city = 'Pretoria, ZA'
@diraulo
diraulo / config.rb
Created December 12, 2016 17:53
Code snippet for medium post on deploying Middleman sites via SemaphoreCI - Use env variables
# ... more configs
activate :deploy do |deploy|
deploy.deploy_method = :rsync
deploy.host = ENV.fetch('DEPLOY_HOST')
deploy.path = ENV.fetch('DEPLOY_DIR')
deploy.build_before = true
deploy.clean = true
end
@diraulo
diraulo / config.rb
Last active December 12, 2016 17:51
Code snippet for medium post on deploying Middleman sites via SemaphoreCI
# ... More configs
activate :deploy do |deploy|
deploy.deploy_method = :rsync
deploy.host = 'user@hostname_or_server_ip'
deploy.path = '/path/to/website/root'
deploy.build_before = true
deploy.clean = true
end
@diraulo
diraulo / packages.json
Created August 13, 2016 19:11
List of Atom Packages for Craft Academy Students
[
{
"name": "Handlebars",
"version": "1.5.1"
},
{
"name": "about",
"version": "1.5.2"
},
{

Keybase proof

I hereby claim:

  • I am diraulo on github.
  • I am diraulo (https://keybase.io/diraulo) on keybase.
  • I have a public key whose fingerprint is E4E9 4446 BA8A 1D83 6B6A 7752 F9EE 2CDC 21D1 9C0E

To claim this, I am signing this object:

@diraulo
diraulo / create_swap.md
Last active March 1, 2017 11:46
Deploying a Rails Application on a DigitalOcean VPS

Run the following as root

$ dd if=/dev/zero of=/swapfile bs=1M count=[swap_size] # swap_size = 1024 for 1GB
$ chmod -R 0600 /swapfile
$ mkswap /swapfile
$ swapon /swapfile

Add the swap to your fstab. To do so edit /etc/fstab and add the following line

@diraulo
diraulo / gist:487c48b4bf74beb9dbcc
Created May 4, 2014 19:15
Vagrantfile for EdX Saas class
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Server Configuration
# Set a local private network IP address.
# See http://en.wikipedia.org/wiki/Private_network for explanation
# You can use the following IP ranges:
# 10.0.0.1 - 10.255.255.254
# 172.16.0.1 - 172.31.255.254