Skip to content

Instantly share code, notes, and snippets.

View Feuda's full-sized avatar
👋
Hi

Feuda Nan Feuda

👋
Hi
View GitHub Profile
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active June 7, 2024 20:53
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@d2s
d2s / installing-node-with-nvm.md
Last active March 13, 2024 12:09
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
@ivanyv
ivanyv / application.amp.erb
Created December 12, 2015 02:51
Easy Google AMP on Rails
<html>
<head>
<link rel="canonical" href="<%= current_uri_sans_amp %>">
</head>
...
</html>
// transform cropper dataURI output to a Blob which Dropzone accepts
function dataURItoBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
}
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 28, 2024 02:47
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@soumyaray
soumyaray / async_http.rb
Last active April 11, 2023 06:26
Async and Sync HTTP calls in Ruby
require 'net/http'
def sync_call(urls)
urls.each do |u|
u['content'] = Net::HTTP.get( URI.parse(u['link']) )
end
end
def async_call(urls)
threads = urls.map do |u|
@ShPakvel
ShPakvel / Event.rb
Created June 25, 2014 10:11
Rails 4 enum and simple_form with I18n
class Event < ActiveRecord::Base
STATUSES = [ :cancelled, :in_progress, :completed, :invoiced ]
enum status: STATUSES
...
end
@lenart
lenart / deploy.rb
Created September 25, 2013 18:44
Capistrano tasks to use with figaro gem.
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
desc "Symlink application.yml to the release path"
task :symlink do
run "ln -sf #{shared_path}/application.yml #{latest_release}/config/application.yml"
end
@sauloperez
sauloperez / signal_catching.rb
Last active November 11, 2020 11:25
How to catch SIGINT and SIGTERM signals in Ruby
# Signal catching
def shut_down
puts "\nShutting down gracefully..."
sleep 1
end
puts "I have PID #{Process.pid}"
# Trap ^C
Signal.trap("INT") {