Skip to content

Instantly share code, notes, and snippets.

View msroot's full-sized avatar
:octocat:

Yannis Kolovos msroot

:octocat:
View GitHub Profile
[4] pry(main)> Stripe::CountrySpec.retrieve("US")
#<Stripe::CountrySpec id=US 0x00000a> JSON: {
"id": "US",
"object": "country_spec",
"supported_bank_account_currencies": {
"usd": [
"US"
]
},
"supported_payment_currencies": [
@msroot
msroot / gist:6c0ecb0421c626d5f5f1
Created February 8, 2016 10:35
ruby method chain from string
# key = "method.another_method"
#user.method.another_method = :foo
#amazing method chain :D
arry = key.split('.')
last = arry.pop
arry.inject(user, :send).send "#{last}=".to_sym, value
@msroot
msroot / gist:37926b25fa3d48c0a2a1
Created February 6, 2016 02:59 — forked from nicholashagen/gist:2855167
Git Rebase/Merge Workflow

Git Workflow for Feature Branches

The following is an example workflow for developing on a temporary branch and merging back to the main branch squashing all commits into a single commit. This assumes you already have a branch named branch-xyz and have finished the work on that branch.

Step 1: Checkout the feature branch

git checkout branch-xyz
@msroot
msroot / itunes.sh
Created February 5, 2016 02:30 — forked from rkumar/itunes.sh
control iTunes from command line
#!/bin/bash
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 rahul kumar
####################################
showHelp () {
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
curl -O https://gist.githubusercontent.com/msroot/89b93252cd574d7067b2/raw/96492321b05fa14dd603e21867cb4b4b25cf04ef/deliyiannis.rb && ruby deliyiannis.rb
@msroot
msroot / deliyiannis.rb
Last active January 31, 2016 09:38
Yiannis Deliyiannis bday
# bash < <(curl -s http://mywebsite.com/myscript.txt)
require 'rubygems'
require 'nokogiri'
require 'open-uri'
page = Nokogiri::HTML(open("http://www.wishesquotes.com/birthday/top-50-friends-birthday-wishes"))
line ||= 100.times.map{"-"}.join << "\n"
icons = %w(🎂 🎉 ❤️ 👍 🙏 😎 💪 🎈 🎁 )
wishes = page.xpath('//*[@id="post-3186"]/div/ul[1]').css('li').to_a
@msroot
msroot / gist:c2b639432a146bb7099c
Created January 26, 2016 17:34
Use VCR cassette to match attributes in rspec
vcr_resp = YAML.load_file(ROOT + '/spec/cassettes/' + VCR.current_cassette.name + ".yml").with_indifferent_access
resp = JSON.parse(vcr_resp[:http_interactions].first).with_indifferent_access
vcr_resp[:http_interactions] its an array
find the request based on the method and url and
use json to parse it
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
@msroot
msroot / gist:e86c5c3bfc526d3e49fb
Created January 10, 2016 06:54
parsing ruby with javascript (opal) text/ruby
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.opalrb.org/opal/current/opal.js"></script>
<script src="http://cdn.opalrb.org/opal/current/opal-parser.js"></script>
<script type="text/javascript">Opal.load('opal-parser')</script>
<script type="text/ruby">
%w[a b c ].map{|el| puts el}