Skip to content

Instantly share code, notes, and snippets.

# Add it in your alias
# usage: bash-record final_gif_name speed:optional cast_file:optional
#
# Requires asciinema and docker.
# Optional to have gifsicle for gif optimization.
#
# Examples:
# bash-record testing-command-x
# bash-record slow-recording-x 2
# bash-record please-faster-x 20 /tmp/slow-recording-x.cast
@everaldo
everaldo / rectangularnotch.dart
Created May 25, 2020 23:02 — forked from erluxman/rectangularnotch.dart
Rectangular notched Fab
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@everaldo
everaldo / rectangularnotch.dart
Created May 25, 2020 23:02 — forked from erluxman/rectangularnotch.dart
Rectangular notched Fab
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@everaldo
everaldo / plink-plonk.js
Created February 19, 2020 21:46 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@everaldo
everaldo / ReactCarrierwaveImageUploadBlogPost.md
Created December 6, 2018 18:10 — forked from joemusacchia/ReactCarrierwaveImageUploadBlogPost.md
Upload images with React and the carrierwave Ruby gem for Rails 5

Upload images with React and the carrierwave Ruby gem for Rails 5

I recently attended a 4.5 month, intensive coding bootcamp in Boston, MA called Launch Academy. I spent a lot of time in academic science doing imaging research, so I naturally had an interest in learning how to manipulate images in this new web browser environment. For my capstone project, I created a very simple image editing Rails app where I realized I needed to be able to save/upload images to my database.

Since, through earnest effort, I wanted my app to use React for a single-page experience, and I quickly discovered that my desire to use a React/fetch/carrierwave/fog/Rails strategy was initially difficult to learn. I had to pull information from many sources (StackOverflow, Medium, official docs, other blog posts, course instructors, etc) to develop a method that uses this specific POSTing cycle.

This blog post represents my findings to integrate all these technologies in a modern, seamless

@everaldo
everaldo / passenger_process_monitor.rb
Created May 15, 2018 01:46 — forked from dazoakley/passenger_process_monitor.rb
Script for killing errant passenger processes
#!/usr/bin/env ruby
#
# Passenger Process Monitor
#
# By Darren Oakley
# Based heavily on a script by James Smith (https://gist.github.com/851520)
# That in turn was based on a similar script by Jon Bettcher
#
# - Check memory usage of all paseenger child process and kill if grows too large.
@everaldo
everaldo / rspec_helper.rb
Created March 3, 2018 04:36 — forked from mlanett/rspec_helper.rb
Helper to clear redis before/after examples in rspec.
=begin
Include in your rspec config like so:
RSpec.configure do |spec|
spec.include RSpec::RedisHelper, redis: true
end
This helper will clean redis around each example.
=end
@everaldo
everaldo / webpack-rails-1.markdown
Created August 31, 2017 05:35 — forked from jarednorman/webpack-rails-1.markdown
Webpack with Rails Part 1

Webpack with Rails Part 1

I don't like Sprockets, but it's the easiest and best choice for lots of Ruby on Rails projects. When looking for a better way to manage my JavaScript assets and an improved developer story, my current tool of choice is webpack. While I wish Rails supported drop-in asset pipelines the way that Phoenix does, it's not hard to use webpack with Rails.

@everaldo
everaldo / ColorUtil
Created April 12, 2017 13:45 — forked from martintreurnicht/ColorUtil
Lighten and darken colors in android
public static int lighten(int color, double fraction) {
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
red = lightenColor(red, fraction);
green = lightenColor(green, fraction);
blue = lightenColor(blue, fraction);
int alpha = Color.alpha(color);
return Color.argb(alpha, red, green, blue);
}

Concept

(The blockquote style does not look so well so I just pasted directly, but these are all quoted from the links in the bottom of this page)

You should not implement to_str unless your object acts like a string, rather than just having a string representation. The only core class that implements to_str is String itself.

[to_i and to_s] are not particularly strict: if an object has some kind of decent representation as a string, for example, it will probably have a to_s method… [to_int and to_str] are strict conversion functions: you implement them only if you object can naturally be used every place a string or an integer could be used.

to_str is used by methods such as String#concat to convert their arguments to a string. Unlike to_s, which is supported by almost all classes, to_str is normally implemented only by those classes that act like strings. Of the built-in classes, only Exception and String implement to_str