Skip to content

Instantly share code, notes, and snippets.

View div's full-sized avatar

Igor Davydov div

  • Barcelona, Spain
View GitHub Profile
@wojtha
wojtha / fake_stripe_server.rb
Last active September 28, 2016 22:06
Fake Stripe mock backend server for generating tokens for stripe.js
#!/usr/bin/env ruby
require 'sinatra/base'
require 'json'
require 'stripe_mock'
# Mount fake Sinatra Stripe Server to Capybara
#
# Example:
#
# feature 'Subscribe' do
@aberke
aberke / gist:042eef0f37dba1138f9e
Last active June 20, 2020 05:17
AngularJS module for phonenumber inputs - Includes custom directive that formats telephone number input values as well as filter for format them in text.
/***************************************************
----------------------------------------------------
Author: Alexandra Berke (aberke)
Written: Summer 2014
----------------------------------------------------
Formats the phonenumber as (222) 333-4444 within the input element
Binds only the number 2223334444 to the model
@nicolai86
nicolai86 / ansible-rails example
Created February 12, 2014 06:11
a current usage example for nicolai86.rails-deployment as of v0.6.0
---
- hosts: server
user: app_user
gather_facts: False
vars:
user: app_user
home_directory: "/home/{{ user }}"
deploy_to: "{{ home_directory }}/app"
roles:
@ebidel
ebidel / Web Components Resources.md
Last active October 12, 2024 17:10
List of resources related to Web Components
@bennadel
bennadel / lazy-loading-images.htm
Created July 23, 2013 13:04
Lazy Loading Image With AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">
@christhekeele
christhekeele / ALLOWABLE.md
Last active May 16, 2023 10:27
Allowable: A Ruby gem DSL for compound conditionals.

Allowable

A micro-gem DSL for compound conditionals.

Allowable lets you decompose large/long conditional chains into readable, testable, and inspectable segments with Ruby blocks.

Installation

@bantic
bantic / rails_route_recognizer.rb
Last active September 9, 2022 12:22
Programmatically list all routes (/paths) from within a rails app.
class RouteRecognizer
attr_reader :paths
# To use this inside your app, call:
# `RouteRecognizer.new.initial_path_segments`
# This returns an array, e.g.: ['assets','blog','team','faq','users']
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)}
def initialize
@aymanfarhat
aymanfarhat / urlobject.js
Last active July 27, 2017 00:04
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@abitdodgy
abitdodgy / Ubuntu Setup Guide for Rails Deployment.md
Last active January 29, 2018 16:02
A guide for setting up an Ubuntu server for Rails deployment

Rails Deployment with Ubuntu 12.10, RVM, Postgresql, Nginx, and Unicorn.

This setup was used successfully on a DigitalOcean VPS. After much trial and error, and following a number of disparate guides and tutorials, I was able to distil the process to the information found in this gist.

Before getting started, you should create a new server droplet. Login to verify that everything is working correctly.

ssh [email protected]
@ariejan
ariejan / init-sidekiq.sh
Last active December 14, 2015 01:09
Init.d script for managing a Sidekiq worker.
#! /bin/bash
# /etc/init.d/gitlab
# GITLAB
# Maintainer: @randx
# App Version: 3.0
### BEGIN INIT INFO
# Provides: gitlab