Skip to content

Instantly share code, notes, and snippets.

View marcusvmsa's full-sized avatar
🎯
Focusing

Marcus Sá marcusvmsa

🎯
Focusing
  • Vakinha
  • Porto Alegre - Brazil
View GitHub Profile
@marcusvmsa
marcusvmsa / diff.js
Created February 8, 2018 13:00
Deep diff between two object, using lodash/fp
// https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-2324809
const transform = _.transform.convert({
cap: false,
});
const iteratee = baseObj => (result, value, key) => {
if (!_.isEqual(value, baseObj[key])) {
const valIsObj = _.isObject(value) && _.isObject(baseObj[key]);
result[key] = valIsObj === true ? differenceObject(value, baseObj[key]) : value;

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS
@marcusvmsa
marcusvmsa / gist:3527142
Created August 30, 2012 11:58
Como instalei o Imagemagick no mountain lion
brew uninstall imagemagick; brew install imagemagick --build-from-source; brew install libpng; brew link libpng
~$ free -m
total used free shared buffers cached
Mem: 497 441 56 0 1 156
-/+ buffers/cache: 282 214
Swap: 255 131 124
~$ ps -eo pmem,pcpu,rss,vsize,args --sort -pmem | less
%MEM %CPU RSS VSZ COMMAND
9.2 0.0 47056 112108 Rack: /srv/www/oclube.co
@marcusvmsa
marcusvmsa / bulk_gems.rb
Created March 7, 2012 13:49
Instalando várias GEMS de forma automátizada
#Primeiro eu jogo as gems do servidor em um arquivo .txt qualquer
gem list > my_gems.txt
#Esse é o script que vai instalar as gems
bulk_gems.rb
#! /usr/local/bin/ruby
STDIN.readlines.each do |l|
m = l.match /^(\S+) \((.*)\)/
unless m.nil?
@marcusvmsa
marcusvmsa / attr_acessible_security.rb
Created March 6, 2012 01:09 — forked from rafaelp/attr_acessible_security.rb
How to protect against mass assignment attack
# Put this file on config/initializer
# This will create an empty whitelist of attributes available for mass assignment for
# all models in your app. As such, your models will need to explicitly whitelist
# accessible parameters by using an attr_accessible declaration. This technique is best
# applied at the start of a new project. However, for an existing project with a thorough
# set of functional tests, it should be straightforward and relatively quick to insert this
# initializer, run your tests, and expose each attribute (via attr_accessible) as dictated
# by your failing tests.
@marcusvmsa
marcusvmsa / spawn-fcgi.sh
Created September 12, 2011 18:10
spawn-fcgi
spawn-fcgi -a 127.0.0.1 -p 53217 -P /var/run/fastcgi-php.pid -- /usr/bin/php-cgi
@marcusvmsa
marcusvmsa / gist:1140301
Created August 11, 2011 18:00
Tentativa de redirecionamento nginx
server_name .px2.com.br ;
#rewrite ^(.*)\.px2\.com\.br$ http://www.$1.com.br/ permanent;
if ($host ~* "^(.*)\.px2\.com\.br$"){
set $subd $1;
rewrite ^(.*)$ http://$subd.pixelquadrado.com.br$1 permanent;
break;
}
if ($host = 'px2.com.br' ) {
rewrite ^/(.*)$ http://www.pixelquadrado.com.br/$1 permanent;
}
@marcusvmsa
marcusvmsa / gist:942865
Created April 26, 2011 19:02
Exceptions available in your Ruby on Rails project
all_exceptions = []
ObjectSpace.each_object(Class) do |k|
all_exceptions << k if k.ancestors.include?(Exception)
end