Skip to content

Instantly share code, notes, and snippets.

View lafeber's full-sized avatar

Martijn Lafeber lafeber

View GitHub Profile
trap("SIGINT") { exit! }
total_width = `stty size`.scan(/\d+/)[1].to_i # terminal width
snowflakes = {}
puts "\033[2J"; # clearing output
loop do
snowflakes[rand(total_width)] = 0
@clupprich
clupprich / spinner.rb
Created October 29, 2021 08:34
Terminal Spinner
%w( ).cycle { |dot| print "\b#{dot}"; sleep 0.1 }
import { Controller } from "stimulus";
import { get } from "@rails/request.js";
import { PageSnapshot } from "@hotwired/turbo";
export default class extends Controller {
static values = { hoverTime: Number };
connect() {
this.element.addEventListener("mouseover", this.prefetch.bind(this));
this.element.addEventListener("touchstart", this.prefetch.bind(this));
}
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
# This is the complete source code to Flappy Dragon:
# https://dragonruby.itch.io/flappydragon
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class FlappyDragon
attr_accessor :grid, :inputs, :game, :outputs
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active September 18, 2024 07:16
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@jeffkreeftmeijer
jeffkreeftmeijer / README.md
Last active January 30, 2019 09:45
enough.css is a tiny CSS style sheet with most of the styling you'll need for that blog of yours. It moved to https://github.com/jeffkreeftmeijer/enough.css
@gudata
gudata / simple_form.rb
Created November 7, 2016 17:23
simple form initialization for http://materializecss.com/
# Use this setup block to configure all options available in SimpleForm.
# https://github.com/patricklindsay/simple_form-materialize/blob/master/lib/generators/simple_form/materialize/templates/config/initializers/simple_form_materialize.rb
# contribute here: https://github.com/mkhairi/materialize-sass/issues/16
SimpleForm.setup do |config|
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
.hamburger {
padding-left: 10px;
width: 50px;
height: 50px;
float: right;
cursor: pointer;
> div {
margin: 18px 0 0 6px;
width: 30px;
height: 20px;
@brunosan
brunosan / index.md
Last active June 15, 2018 23:57
This is a list inspired by some of our current or potential lines of work at the World Bank Innovation Labs. The “Innovations in Big Data Analytics” program helps to strengthen the World Bank capabilities to effectively use big data in its operational and strategic work.

This is a list inspired by some of our current or potential lines of work at the World Bank Innovation Labs. The “Innovations in Big Data Analytics” program helps to strengthen the World Bank capabilities to effectively use big data in its operational and strategic work.

We are always looking for great Data Scientists. If you can solve any of these [using open software], you'll be heads down helping us from day one. Email us to brunosanchez@worldbank.org

(This list is updated frequently).

1. Nightlights from Satellite

We are building an open stack to process nightly data from satellite and query light output from all known villages. Currently we are doing 20 years of nightly data for 600,000 villages in India.