Skip to content

Instantly share code, notes, and snippets.

describe "#list_units" do
let(:unit_list) do
'unit' => [
{
'name' => 'foo.service'
'currentstate' => 'a'
'desiredstate' => 'b'
'options' => 'c'
}
]
@bonyiii
bonyiii / facebook_graph_api.rb
Last active August 29, 2015 14:26 — forked from zosiu/facebook_graph_api.rb
Facebook Graph API w/ Koala
### app access token
graph = Koala::Facebook::OAuth.new APP_ID, APP_SECRET
graph.get_app_access_token # => APP_TOKEN
### create test users with permissions
test_users = Koala::Facebook::TestUsers.new app_id: APP_ID, secret: APP_SECRET
user = test_users.create true, 'email,user_birthday,user_posts', name: 'Bob'
# =>
# { "id" => USER_ID,
# "access_token" => USER_ACCESS_TOKEN,
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
class MyApp.CarsController extends Batman.ApplicationController
# Appears to work the same way MyApp.CarsIndexView#viewDidAppear
@afterAction only: "index", ->
$('table').dataTable()
index: (params) ->
@set('cars', MyApp.Car.get('all'))
@bonyiii
bonyiii / gist:9531930
Created March 13, 2014 16:35
berlin clock
# TODO
# tömbként tároljuk az lámpa sorokat
# lámp sorok tömbe tartalmazzák a state -ket
# másodperc alapján eldöntjük az első sort
# óra / 5 kidja a második sorban színes lámpák számát annyi indexet felkapcsolunk
# óra mod 5 vissza adja a harmadik sor szines lámpák számát
# perc / 5 negyedik sor minden 3 piros
# pert mod 5
#
class BerlinClock
@bonyiii
bonyiii / gist:7439733
Last active December 28, 2015 04:08
opensuse 12.3 tmux.conf with working bash history xterm shortcuts for ctrl + Up/Down
~/.tmux.conf
set-option -g default-terminal xterm-256color
set-window-option -g xterm-keys on
# The key was that
echo $TERM
# in tmux returned screen which is why ctrl+up did not looked up history now it is
xterm-256color
Though it works fine on ubuntu with echo $TERM screen
@bonyiii
bonyiii / gist:6184489
Created August 8, 2013 13:16
ruby multithread
http://speakmy.name/2013/04/02/concurrent-programming-and-threads-in-ruby-reading-list/
Concurrent Programming and Threads in Ruby - a reading list
02 April 2013
Many rubyists consider threads in Ruby as somewhat of an arcane knowledge, though in reality they’re a very well researched and understood concept. Of course, writing effective multithreaded concurrent programs requires certain amount of knowledge and discipline from the programmer, but there’s nothing that a smart one can’t learn if he wants to.
To help with the task, awesome @brainopia compiled a list of recommended reading on the topic of concurrency and threads. All kudos go to @brainopia, and the original list in Russian as available as a gist here:
Before do |scenario|
DeferredGarbageCollection.start
end
After do |scenario|
DeferredGarbageCollection.reconsider
end
at_exit do
DeferredGarbageCollection.stop
@bonyiii
bonyiii / jobsworth i18n
Last active December 15, 2015 20:41
Jobsworth i18n
actions
activities
admin_stats
billing
common
companies
custom_attributes
customers
devise
email addresses
@bonyiii
bonyiii / gist:4130303
Created November 22, 2012 09:51
git svn
git clone svn://host/repo --stdlayout
git co -b local_trunk trunk
# pull
git svn rebase
#push
git svn dcommit