Skip to content

Instantly share code, notes, and snippets.


Filippos Vasilakis vasilakisfil

View GitHub Profile
havenwood / arity_range.rb
Last active Aug 29, 2015
Ask a method, lambda or proc for the range of arguments it can be called with from minimum to maximum.
View arity_range.rb
module ArityRange
def arity_range
args = &:first
req = args.count :req
opt = args.include?(:rest) ? Float::INFINITY : args.count(:opt)
keyreq = args.count :keyreq
keyopt = args.include?(:keyrest) ? Float::INFINITY : args.count(:key)
echo "=oQM2kzM4MjN0kDN3QzLlNnLztmcvd3ZulmcwN3LvoDc0RHa" | rev | base64 --decode -i

And a PUT request to that resource responds with the next step of the challenge.

d-mart / domain_validator.rb
Created Oct 4, 2012 — forked from rietta/domain_validator.rb
Rails 3 Bare Domain Validator
View domain_validator.rb
# Domain Validator by Frank Rietta
# (C) 2012 Rietta Inc. All Rights Reserved.
# Licensed under terms of the BSD License.
# To use in a validation, add something like this to your model:
# validates :name, :domain => true
class DomainValidator < ActiveModel::EachValidator
Samsinite / array.js
Created Jan 26, 2015
Array transform for ember-data
View array.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Transform.extend({
serialize: function(deserialized) {
return !!deserialized ? deserialized.toArray() : null;
deserialize: function(serialized) {
return Ember.A(serialized);
dklisiaris /
Last active Aug 18, 2017
A manual setup for a typical rails 4.x. app with bootstrap layout, devise authentication, rspec testing framework with capybara and git version control.

Setup a new project and database.

Create a new rails app named app_name without Test::Unit and with mysql database:

rails new app_name -T -d mysql

or an app without Test::Unit and with postgresql database:

rails new app_name -T -d postgresql

or without Test::Unit and with the default sqlite:

View radio-button-component.js
// {{ radio-button name='dish' value='spam' groupValue=selectedDish selectedAction='testAction' }} Spam
// {{ radio-button name='dish' value='eggs' groupValue=selectedDish }} Eggs
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'input',
type: 'radio',
attributeBindings: [ 'checked', 'name', 'type', 'value' ],
jeckel /
Last active Dec 12, 2018
APIDays 2018 Presentations and Resources

Twitter LinkedIn

APIDays Logo

APIDays 2018 - Presentations and Resources

Here is a collection of links to presentations and other resources shared during the last #APIDays2018 in Paris.

If you find some mistakes, or have any links to add to this list, feel free to add some comments, or contact me on Twitter or LinkedIn

vasilakisfil /
Last active Jun 11, 2020
New linux machine setup
#install essential stuff
sudo apt-get install build-essential autoconf locate
sudo apt-get install git guake zsh curl vim vim-gtk3 postgresql-client \
postgresql postgresql-contrib redis golang direnv tmux bat ripgrep fzf
curl -L | sh
chsh -s /bin/zsh
#edit pg_hba.conf
alex-zige / gist:5795358
Last active Feb 27, 2021
Rails Rspec API Testing Notes
View gist:5795358

Rails Rspec APIs Testing Notes

Folders Structure

  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
jingoro / gist:3015664
Created Jun 29, 2012
Mongoid Callback Sequence
View gist:3015664
require 'rubygems'
require 'bundler/setup'
require 'mongoid'
Mongoid.configure do |config|
config.master ='localhost', 27017, :logger => nil).db('mongoid-test')
class A
include Mongoid::Document