Skip to content

Instantly share code, notes, and snippets.

View zaid's full-sized avatar

Zaid Al-Jarrah zaid

View GitHub Profile
@zaid
zaid / create_event.feature
Created January 15, 2012 00:59
Create event feature
Feature: create an event
In order to organize my social gatherings
As an organizer
I want to create events
Background: Logged-in
Given that I am logged-in
And I click "create event"
@zaid
zaid / create_event.feature
Created January 15, 2012 01:31
Create event feature (using Scenario outlines)
Feature: create an event
In order to organize my social gatherings
As an organizer
I want to create events
Scenario Outline: create a valid event
Given that I am logged-in
And I click "create event"
When I enter "<title>" in the event "title"
@zaid
zaid / gist:1953983
Created March 1, 2012 23:25
Eventos Tuxminator config
# ~/.tmuxinator/eventos.yml
# you can make as many tabs as you wish...
project_name: Eventos
project_root: ~/Development/eventos
socket_name:
pre:
tabs:
- shell:
- guard: bundle exec guard
@zaid
zaid / .tmux.rc
Created March 1, 2012 23:27
TMux's config file
# change default prefix to be like GNU screen
set-option -g prefix C-a
# set the statusbar
set-option -g status-utf8 on
set-option -g status-keys vi
# set window notifications
set-option -g visual-activity on
@zaid
zaid / xlsx_test.rb
Created October 16, 2013 19:32
A small script which generates a file that does not show any columns when opened with Microsoft Excel 2010 unless you highlight all and select the unhide option.
title = "Some report"
selected_columns = %w(one two three four five)
Axlsx::Package.new do |package|
package.workbook do |workbook|
# Disabling this will improve performance for very large documents
workbook.use_autowidth = false
workbook.add_worksheet(:name => 'Data') do |sheet|
@zaid
zaid / keybase.md
Created September 18, 2014 22:55
Keybase Github proof

Keybase proof

I hereby claim:

  • I am zaid on github.
  • I am zaid (https://keybase.io/zaid) on keybase.
  • I have a public key whose fingerprint is ED37 5737 FF32 FEEE 4470 412A A120 9D80 4301 70B4

To claim this, I am signing this object:

@zaid
zaid / pdf_from_msg_extractor.rb
Last active July 21, 2016 15:07
Attachments from Outlook Msgs extractor
require 'mapi/msg'
require 'fileutils'
require 'pdfkit'
require 'nokogiri'
PDFKit.configure do |config|
config.default_options[:load_error_handling] = 'ignore'
config.default_options[:load_media_error_handling] = 'ignore'
config.default_options[:disable_javascript] = true
end
@zaid
zaid / html_to_pdf_converter.rb
Created July 21, 2016 20:45
HTML -> PDF converter which takes into account the file encodings
require 'pdfkit'
require 'nokogiri'
require 'charlock_holmes'
PDFKit.configure do |config|
config.default_options[:load_error_handling] = 'ignore'
config.default_options[:load_media_error_handling] = 'ignore'
config.default_options[:disable_javascript] = true
end
@zaid
zaid / jpgs_to_pdf_converter.rb
Created August 3, 2016 19:19
Simple method to convert JPGs to PDFs
require 'rmagick'
def jpgs_to_pdfs(path)
Dir.glob(File.join(path, '*.{jpg,jpeg,tif,tiff,png}')).each do |file_path|
next unless File.basename(file_path) =~ /\d+[a-z]*_\d+/i
next if File.basename(file_path) =~ /cheque/i
destination_path = "/home/zaid/Downloads/CMS\ PDFs"
destination_filename = "SUP#{File.basename(file_path).match(/\d+[a-z]*/i)[0]}.pdf"
destination_filepath = File.join(destination_path, destination_filename)
@zaid
zaid / .projections.json
Created February 5, 2021 22:28
Elixir projections
{
"lib/*.ex": {
"alternate": "test/{}_test.exs",
"type": "source"
},
"test/*_test.exs": {
"alternate": "lib/{}.ex",
"make": "mix test {file}",
"type": "test"
},