require 'csv'
require 'open-uri'
csv_text = open('http://www.vvv.hh.yyy.ggg/~hhhh/uuuu.csv')
csv = CSV.parse(csv_text, :headers=>true)
csv.each do |row|
puts row
end
View import_and_parse_remote_csv_rails.md
View introrx.md
The introduction to Reactive Programming you've been missing
(by @andrestaltz)
This tutorial as a series of videos
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
View pre-commit.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec 1>&2 | |
if test $(git diff --cached -S'binding.pry' --name-only | | |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 | |
then | |
cat <<\EOF | |
Remove biniding.pry | |
EOF | |
exit 1 | |
fi |
View Untitled-3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# return which shell is used | |
> echo $0 | |
-zsh |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http') | |
const { run, send, json } = require('micro') | |
const PORT = process.env.PORT || 8080 | |
const response = "Hi from MICROservice on K8S draft" | |
const microHttp = fn => http.createServer((req, res) => run(req, res, fn)) | |
const server = microHttp(async (req, res) => { | |
const js = await json(req); | |
const statusCode = 200; | |
const data = { ...js, response }; |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem "sinatra", "~> 2.0" | |
gem "json", "~> 2.1" |
View pre-push.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. Copy the file into your repo at `.git/hooks/pre-push` | |
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push` |
View rbt_publish.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash python rabbitmqadmin publish exchange=amq.default routing_key=test payload="$(cat myjson.json)" |
View move_to_new_branch.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Moving to a new branch | |
# Unless there are other circumstances involved, this can be easily done by branching and rolling back. | |
# Note: Any changes not committed will be lost. | |
git branch newbranch # Create a new branch, saving the desired commits | |
git reset --hard HEAD~1 # Move master back by 3 commits (GONE from master) | |
git checkout newbranch # Go to the new branch that still has the desired commits | |
#from https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git |
View git-reup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Usage: git-up | |
# git-reup | |
# | |
# Like git-pull but show a short and sexy log of changes | |
# immediately after merging (git-up) or rebasing (git-reup). | |
# | |
# Inspired by Kyle Neath's `git up' alias: | |
# http://gist.github.com/249223 |
NewerOlder