Skip to content

Instantly share code, notes, and snippets.

View vasilakisfil's full-sized avatar

Filippos Vasilakis vasilakisfil

View GitHub Profile
@havenwood
havenwood / arity_range.rb
Last active August 29, 2015 13:56
Ask a method, lambda or proc for the range of arguments it can be called with from minimum to maximum.
module ArityRange
def arity_range
args = parameters.map &: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
http://springworks.se/474946383961

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

@d-mart
d-mart / domain_validator.rb
Created October 4, 2012 21:34 — forked from rietta/domain_validator.rb
Rails 3 Bare Domain Validator
#
# 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
Samsinite / array.js
Created January 26, 2015 04:47
Array transform for ember-data
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
dklisiaris / rails-boilerplate.md
Last active August 18, 2017 05:58
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:

// {{ 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
jeckel / APIDays2018-Presentations.md
Last active December 12, 2018 14:39
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

@jingoro
jingoro / gist:3015664
Created June 29, 2012 04:08
Mongoid Callback Sequence
require 'rubygems'
require 'bundler/setup'
require 'mongoid'
Mongoid.configure do |config|
config.master = Mongo::Connection.new('localhost', 27017, :logger => nil).db('mongoid-test')
end
class A
include Mongoid::Document
@mildsunrise
mildsunrise / README.md
Last active January 10, 2022 00:20
Helper program to add HTTP/SOCKS proxy support to SSH

ssh-proxy-dialer

This program adds proxy support to ssh. Once installed, ssh will obey the ssh_proxy environment variable (or all_proxy as a fallback) and will try to connect to the server through that proxy. Example:

export ssh_proxy="socks5://10.139.2.1:8066"
ssh example.com  # will connect through SOCKS5 proxy
@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications