Skip to content

Instantly share code, notes, and snippets.

View relaxdiego's full-sized avatar
🤓

Mark Maglana relaxdiego

🤓
  • The Linux Foundation
  • Earth, Solar System, Milky Way, Laniakea
View GitHub Profile
demo:
provider: openstack
auth_service:
name: identity
host_uri: http://192.168.42.11:5000
request: create_token
validator: list_tenants
api_version: v3
class TestSuite:
@patch('real_class_name')
def test_case(self, mock_class):
# Delay the evaluation of Mock() so that we get
# a new mock object for each time the (mocked)
# class constructor is called.
def new_mock_obj(*args, **kwargs):
mock_obj = Mock()
mock_obj.some_function.return_value = 'w00t'
# git completion
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
# unstaged (*) and staged (+) changes
# export GIT_PS1_SHOWDIRTYSTATE=1
# If something is stashed, then a '$' will be shown next to the branch name
# export GIT_PS1_SHOWSTASHSTATE=1
@relaxdiego
relaxdiego / graphite.md
Last active January 5, 2022 09:07 — forked from surjikal/graphite.md
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

RB.Object = {
// Douglas Crockford's technique for object extension
// http://javascript.crockford.com/prototypal.html
create: function(){
function F(){}
F.prototype = arguments[0];
var obj = new F();
// Add all the other arguments as mixins that
// 'write over' any existing methods
[1] guard(main)> Run options: --seed 2796
# Running tests:
.
Finished tests in 0.001458s, 685.8711 tests/s, 685.8711 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
@relaxdiego
relaxdiego / lexer.rdsl
Last active December 23, 2015 00:59
Initial implementation of self-testing ManaMana (Do doo be-do-do!). I think it's cool that I can do this now. On the other hand, the .tdsl file below feels like an extra/unnecessary step. Clearly, ManaMana, is not well suited as a unit-testing tool which is fine because, when I wrote the gem, I imagined its use as an acceptance tool for a web ap…
RDSL Lexer
==========
* It tokenizes
```
This is a group name
====================
```
into
```
#!/usr/bin/env ruby
class Fixnum
def +(other)
2
end
end
puts 1 + 1 + 1
module Aviator
define_request :create_tenant do
meta :provider, :openstack
meta :service, :identity
meta :api_version, :v2
meta :endpoint_type, :admin
link 'documentation',
require 'formula'
class Dblatex < Formula
url 'http://downloads.sourceforge.net/project/dblatex/dblatex/dblatex-0.3/dblatex-0.3.tar.bz2'
homepage 'http://dblatex.sourceforge.net'
md5 '7de6bf72b8b2934169ce0ec911e966ed'
def install
system "python", "setup.py", "install", "--prefix=#{prefix}", "--install-scripts=#{bin}"
end