Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
require 'sshkit'
require 'sshkit/dsl'
require 'sshkit/sudo'
include SSHKit::DSL
DOKKU_VERSION = 'v0.35.15'
HOST = ENV.fetch('DOKKU_HOST')
@bankair
bankair / gist:b1e381e6559e43ba059a12388f9d7922
Created September 29, 2022 07:28
Tips for ruby for M1 macbook

How to setup on Mac M1

Install Xcode Command Line Tools

xcode-select --install

Remove brew if you have it already

Install Rosetta2

{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Alexandre Ignjatovic",
"label": "Senior Technical Leader",
"image": "https://avatars.githubusercontent.com/u/365999?v=4",
"email": "[email protected]",
"phone": "+33 6 07 77 82 12",
"url": "https://podcast.ausha.co/le-pretexte",
"summary": "Alexandre is fascinated by people and technology. Focused on building great teams and useful technology since 2004, he worked initially 10 years in investment banking, where he learned about discipline and attention to detail. He then turned toward startups to find more meaning in his work and have a wider, more direct and positive impact. He is managing technical teams as a servant leader since 2012. Be sure to check out LinkedIn for a detailed version of this resume.",
class RecipesController < ApplicationController
# GET /recipes
def index
@recipes = Recipe.all.includes(:ingredients)
end
end
<% @recipes.each do |recipe| %>
<article>
<h2><%= recipe.title %></h2>
<ul>
<% recipe.ingredients.each do |ingredient| %>
<li><%= ingredient.name %> <small>(<%= ingredient.quantity %>)</small></li>
<% end %>
</ul>
</article>
<% end %>
class RecipesController < ApplicationController
# GET /recipes
def index
@recipes = Recipe.all
end
end
@bankair
bankair / find_bullshit.rb
Created September 20, 2017 08:34
Try to find and display sentences generated by the Corporate Bullshit Generator (http://cbsg.sf.net/) matching specific keywords
require 'open-uri'
require 'nokogiri'
require 'colorize'
def fetch(keywords)
bullshits = Nokogiri::HTML(open('http://cbsg.sourceforge.net/cgi-bin/live'))
.css('font ul li')
.map { |node| node.children.first.content }
return bullshits if keywords.empty?
bullshits.select do |txt|
require 'rumouse'
class Position
class << self
def mouse
@mouse ||= RuMouse.new
end
def current
new(*mouse.position.values)
@bankair
bankair / chrono.rb
Created July 12, 2016 07:56
A timestamping helper in ruby
class Chrono < Hash
attr_accessor :last, :section, :total
def initialize(new_section = :unknown)
super(0.0)
self.last = Time.now
self.section = new_section
self.total = 0.0
end
def top(new_section = :unknown)
class Proc
def + (first)
Proc.new { |*args| call(*first.call(*args)) }
end
end