Skip to content

Instantly share code, notes, and snippets.

View delphaber's full-sized avatar

Fabrizio Monti delphaber

View GitHub Profile
@Arkham
Arkham / vimrc
Created March 24, 2014 16:50
Convert old rspec should syntax to new expect syntax
function! ConvertShouldToExpect()
let rspec_conversions = {
\ 'should': 'to',
\ 'should_not': 'not_to',
\ 'should_receive': 'to receive',
\ 'should_not_receive': 'not_to receive',
\ }
for [old, new] in items(rspec_conversions)
execute "normal! " . ':%s/\v^(\s+)(.+)\.' . old . '>/\1expect(\2).' . new . '/ge' . "\<CR>"
@brodock
brodock / zurb-chosen.css.scss
Last active August 29, 2015 13:57
This is Chosen stylesheet to use with ZURB Framework 5 (it expects to have @import "foundation" before this file is imported)
@import "chosen";
.chosen-container {
font-size: inherit;
margin-bottom: $form-spacing;
.chosen-single div {
background: none;
border-left: none;
position: absolute;
@demisx
demisx / angularjs-providers-explained.md
Last active December 26, 2024 05:39
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@cam8001
cam8001 / dapply
Last active December 6, 2024 20:29
Apply a patch directly from a URL without downloading it first.
#!/bin/bash
# Downloads and applies a patch from Drupal.org.
if [ -z "$1" ]
then
echo "You need to supply a URL to a patch file."
exit
fi
URL=$1;
@pcreux
pcreux / 0-gourmet-service-objects.md
Last active August 21, 2022 15:32
Gourmet Service Objects - Lightning Talk - http://vanruby.org - Feb 27, 2014

Gourmet Service objects

 @pcreux

 Feb 27, 2014
 http://vanruby.org
@mukkoo
mukkoo / media-query.sass
Created February 28, 2014 11:55
Sass media queries
$mobile-size: 320px
$tablet-size: 768px
$netbook-size: 1030px
$desktop-size: 1600px
$mobile: "all and (max-width: #{$mobile-size})"
$tablet: "all and (min-width: #{($mobile-size + 1)}) and (max-width: #{$tablet-size})"
$netbook: "all and (min-width: #{($tablet-size + 1)}) and (max-width: #{$netbook-size})"
$desktop: "all and (min-width: #{$netbook-size + 1}) and (max-width: #{$desktop-size})"
$big-desktop: "all and (min-width: #{$desktop-size + 1})"
@toobulkeh
toobulkeh / deploy.rb
Created January 2, 2014 02:42 — forked from benedikt/rails.rb
Updated for Capistrano 3.
# encoding: UTF-8
# Place in config/deploy.rb
namespace :rails do
desc "Open the rails console on each of the remote servers"
task :console do
on roles(:app) do |host| #does it for each host, bad.
rails_env = fetch(:stage)
execute_interactively "ruby #{current_path}/script/rails console #{rails_env}"
@tadast
tadast / Alphasights_technical_challenge.md
Last active April 3, 2024 12:25
A technical challenge we give to our Ruby on Rails applicants in order to evaluate their coding proficiency.Job description: http://www.alphasights.com/positions/ruby-developer-london or http://www.alphasights.com/positions/ruby-developer-new-york

Update: I no longer work for the company and this challenge is no longer used, but I'll leave the gist here in case people want to practice.

Alphasights Technical Challenge

Using Ruby on Rails we would like you to create a simple expert search tool. The application should fulfill the requirements below. The source code must be placed in a public repo on GitHub. The application should be deployable on Heroku.

  • I enter a name and a personal website address and a member is created.
  • When a member is created, all the heading (h1-h3) values are pulled in from the website to that members profile.
  • The website url is shortened (e.g. using http://goo.gl)
  • After the member has been added, I can define their friendships with other existing members. Friendships are bi-directional i.e. If Sasha is a friend of Ash, Ash is always a friend of Sasha as well.
@Arkham
Arkham / gist:5592899
Created May 16, 2013 16:08
active_admin monkey patch
module ActiveAdmin
module Views
class PaginatedCollection < ActiveAdmin::Component
protected
def build_pagination_with_formats(options)
div :id => "index_footer" do
build_pagination
div(page_entries_info(options).html_safe, :class => "pagination_information")
@crisu83
crisu83 / AuthFilter.php
Created January 12, 2013 21:48
AuthFilter class from the Auth module for the Yii PHP framework.
<?php
/**
* AuthFilter class file.
* @author Christoffer Niska <[email protected]>
* @copyright Copyright &copy; Christoffer Niska 2012-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package auth.components
*/
/**