Skip to content

Instantly share code, notes, and snippets.

View djaiss's full-sized avatar
👋
Maker of open source web softwares.

Mazarin djaiss

👋
Maker of open source web softwares.
View GitHub Profile
@djaiss
djaiss / gist:9514127
Last active August 29, 2015 13:57
VIM ⌘+A
To put in your .vimrc:
nmap <leader>a gg<CR>^<CR>V<CR>G<CR>$<cr>
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111

Notes

This is the latest version of an email which I send periodically, offering customers the opportunity to pre-pay for SaaS in return for a discount. The benefits to the SaaS company are better cash flow and reduced churn rate. The benefits to the customer are, well, in the email. This genre of email has produced hundreds of thousands of dollars in pre-pays for some companies I work with, and it rarely requires any more work than this example.

I've put $79 is as a placeholder for the cost of the user's plan. We calculate that for each account, naturally, along with the billing contact's name.

Subject: Save $79 on Appointment Reminder (and get a tax write-off) Formatting: 100% plain text. Gmail automatically links up the central link. From: Patrick McKenzie (Appointment Reminder) patrick@appointmentreminder.org

@djaiss
djaiss / gist:e14b8b70dcb89c6e016b
Created January 4, 2015 18:22
Differences between dates from the command line
require 'date'
t = Time.now
endDate = Date.new(t.year, t.month, t.day)
startDate = Date.new(2011, 11, 22)
days = endDate - startDate
puts days.to_i
@djaiss
djaiss / gist:24d5542ffbeeb9f30c70
Created January 4, 2015 18:29
Password generator command line
# stolen from http://invert.svbtle.com/using-vim-as-a-password-manager
import random
f = open('/usr/share/dict/words')
words = map(lambda x: x.strip(), f.readlines())
password = '-'.join(random.choice(words) for i in range(2)).capitalize()
password += str(random.randint(1, 9999))
print password
@djaiss
djaiss / gist:a55d5b9df87aa1892f6a
Created April 7, 2015 13:08
Get hostname on the current machine
# Wait for it
`hostname`
Done.
@djaiss
djaiss / db_size.sql
Last active August 29, 2015 14:28
Calculate the size of your Mysql DB
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;
@djaiss
djaiss / rails_link.rb
Created March 31, 2011 13:30
Rails link to an image instead of text
@djaiss
djaiss / hack.sh
Created March 31, 2012 13:41 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@djaiss
djaiss / gist:3034558
Created July 2, 2012 17:50
PHP - List of countries
<?php
$countries =
array(
"ae" => "United Arab Emirates",
"ao" => "Angola",
"bf" => "Burkina Faso",
"bi" => "Burundi",
"bj" => "Benin",
"bw" => "Botswana",