Skip to content

Instantly share code, notes, and snippets.

View franciscomxs's full-sized avatar
🏠
Working from home

Francisco Martins franciscomxs

🏠
Working from home
View GitHub Profile
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active July 4, 2024 14:08
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@callmeloureiro
callmeloureiro / comoNaoDeixarNoVaucoNoWhatsapp.js
Last active June 5, 2021 13:29
Como não deixar no vácuo no whatsapp
/*
Hoje não deixaremos mais ninguém no vácuo no whatsapp
Para utilizar:
- Abra o web.whatsapp.com;
- Abra o console e cole o código que está no gist;
- Aguarde e verá uma mensagem sendo enviada a cada momento que alguém te enviar alguma mensagem.
Confira também como ser chato no whatsapp: https://gist.github.com/mathloureiro/4c74d60f051ed59650cc76d1da0d32da
e como ser chato no mensseger: https://gist.github.com/mathloureiro/d3f91d19cf148838217e42a0c6df5ed8
*/
@Gi-lo
Gi-lo / gist:4279932
Created December 13, 2012 21:11
Easily create GET NSURLs in Objective-C. (Used in https://github.com/Gi-lo/GCXHTTPOperation )
- (NSURL *)URLWithString:(NSString *)string andQueryValuesForKeys:(NSString *)value, ... {
if (!value) {
return [NSURL URLWithString:string];
}
NSMutableString *queryString = [NSMutableString string];
NSString *argument = nil;
NSUInteger argumentCount = 0;
va_list argumentList;
@petewarden
petewarden / webpage2png.rb
Created November 28, 2011 02:44
An example of using PhantomJS from Ruby to do server-side rendering of a web page into a PNG
require 'rubygems' if RUBY_VERSION < '1.9'
require 'tempfile'
require File.join(ENV['JETPAC_PATH'], 'library/logger')
require File.join(ENV['JETPAC_PATH'], 'library/email')
def image_command(command)
log "IMG: Running '#{command}'"
result = system(command)
if !result