Skip to content

Instantly share code, notes, and snippets.

View ashishwadekar's full-sized avatar

Ashish Wadekar ashishwadekar

  • India
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@3dd13
3dd13 / row_is_cut_in_the_middle_solution.rb
Created February 18, 2011 07:49
overflow / page break examples of Prawn Pdf generation.
# gem "prawn", "0.8.4"
# Sometime there is no enough space for the last table row when it reaches the end of page
Prawn::Document.generate("text_group_overflow_question.pdf") do |pdf|
add_page_break_if_overflow(pdf) do |pdf|
# generating table here
# ...
end
end
@RiANOl
RiANOl / gist:1077760
Last active April 13, 2024 06:17
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@xdite
xdite / 42-things.md
Created July 14, 2012 05:11
Ten (42) Things You Didn't Know Rails Could Do
class Ticket < ActiveRecord::Base
belongs_to :grouper
belongs_to :user
validate :user_cant_be_blacklisted, on: :confirmation
validate :user_cant_double_book, on: :confirmation
validate :grouper_cant_be_full, on: :confirmation
validate :grouper_cant_have_occurred, on: :confirmation
module JsonSerializer
module_function
#
# Usage:
# JsonSerializer.find_by_id(User, 1, only: [:id, :email, :address], except: [:address])
#
def find_by_id(klass, id, options = {})
sql = "SELECT row_to_json(results) FROM (
SELECT #{selected_attributes(klass, options)}
#!/usr/bin/env ruby
# Requires that you have ./bin/dcpTool from https://sourceforge.net/projects/dcptool/
require 'rubygems'
require 'bundler/setup'
require 'nokogiri'
input_camera_model = ARGV[0] || "LEICA Q (Typ 116)"
output_camera_model = ARGV[1] || "LEICA M10"
@ammarshah
ammarshah / all_email_provider_domains.txt
Last active June 27, 2024 14:16
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@Ethanhackett
Ethanhackett / fontawesome.vue
Last active January 18, 2019 09:53
Font Awesome 5 Pro - Vue.js + Native Script Component
<template>
<Span v-bind:class="classes + ' ' + type" v-bind:text="getIcon()" />
</template>
<script>
/*
Setup:
1. Setup CSS and Font in Native Script App like this:
https://medium.com/@JCAguilera/fontawesome-5-and-nativescript-22653f2b3bac
Thanks > Juanky Aguilera