Skip to content

Instantly share code, notes, and snippets.

View brpaz's full-sized avatar

Bruno Paz brpaz

View GitHub Profile
@brpaz
brpaz / bash_for_loop_in_files.sh
Last active August 29, 2015 14:13
Iterates over all files in directory #bash #filesystem
for dir in */; do
echo "$dir"
done
@brpaz
brpaz / public_key_encryption.php
Created January 21, 2015 20:06
Public-Key Encryption with PHP #php #encryption #public-key (source: http://josephspurrier.com/public-key-encryption-with-php)
// Generate a public and private key
function generate()
{
// Set the key parameters
$config = array(
"digest_alg" => "sha512",
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);

SASS

Variables

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
@brpaz
brpaz / getops.sh
Created January 24, 2015 13:11
Example how to use getops bash function to parse cmd line options. #bash
#!/bin/sh
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
# Initialize our own variables:
output_file=""
verbose=0
while getopts "h?vf:" opt; do
@brpaz
brpaz / aws_s3_cli_examples.md
Last active August 29, 2015 14:14 — forked from magnetikonline/README.md
AWS CLI S3 usage examples. #aws #s3
@brpaz
brpaz / chrome_extension_manifest_sample.json
Created January 31, 2015 11:46
Sample shortcut chrome extension #aws #chrome
{
"manifest_version": 2,
"name": "AWS Console",
"description": "Just a shortcut to AWS Management Console",
"version": "1.0",
"icons": {
"128": "icon-128.png"
},
"app": {
"urls": [
@brpaz
brpaz / aws_s3_bucket_policies.json
Created January 31, 2015 17:35
AWS S3 Bucket policy #aws #aws-s3
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
@brpaz
brpaz / Rakefile.rb
Created February 22, 2015 09:55 — forked from kinopyo/gist:3444889
Rake task example #rake
# [RAILS_ROOT]/lib/tasks/sample.rake
desc "print hello world!" # description.
task "hello_world" do # rake task name.
p "hello world!" # print "hello world!"
end
namespace :myapp do
desc "import data from somewhere"
# load rails environment
@brpaz
brpaz / phpspec_cheatsheet.md
Last active August 29, 2015 14:15 — forked from pedroborges/phpspec_cheatsheet.md
From Marcello Duarte's PhpSpec 2.0 ilustrated by examples slides (http://pt.slideshare.net/marcello.duarte/phpspec-20-ilustrated-by-examples) #php #phpspec #cheatsheet

PhpSpec 2.0 Cheat Sheet

Object: $result ($this)

Expectation: should or shouldNot

Matcher: Be...()

Types of Matchers:

@brpaz
brpaz / rails_models_cheatsheet.md
Last active August 29, 2015 14:17 — forked from rstacruz/index.md
Rails models cheatsheet #rails #ruby

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one