Skip to content

Instantly share code, notes, and snippets.

View ramon-sg's full-sized avatar

Ramón Soto ramon-sg

  • Concepción, Chile
View GitHub Profile
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@njakobsen
njakobsen / gist:6395146
Last active September 29, 2016 20:00
Poor man's outer join for rails. Just extend ActiveRecord::Base with this beauty, and voila! MyModel.outer_joins(:some_association).ftw!
module OuterJoins
def outer_joins(*associations)
pattern = / (?:INNER )?JOIN /i
scope = all
associations.each do |association|
inner_join_sql = scope.unscoped.joins(association).to_sql
outer_join_sql = inner_join_sql.gsub(pattern, ' LEFT OUTER JOIN ')
scope = scope.joins(outer_join_sql[/LEFT OUTER JOIN .+/])
end
@Geek-MD
Geek-MD / qemu_osx_rpi_raspbian_jessie.sh
Last active December 30, 2020 10:51 — forked from hfreire/qemu_osx_rpi_raspbian_jessie.sh
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (Sierra)
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install QEMU OSX port with ARM support
brew install qemu
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
brew install wget
wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.34-jessie
@rhernandog
rhernandog / regiones-provincias-comunas.json
Last active October 14, 2021 14:40
Archivo en formato JSON con las regiones de Chile, sus provincias y las respectivas comunas de cada provincia.
[
{
"region": "Arica y Parinacota",
"region_number": "XV",
"region_iso_3166_2": "CL-AP",
"provincias": [
{
"name": "Arica",
"comunas": [
{
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 24, 2024 08:13
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@andrewhao
andrewhao / 01.ex
Last active January 26, 2021 16:57
Lightweight Elixir dependency injection
module MyApp.MyModule do
@my_collaborating_module Application.get_env(:my_app, :my_collaborating_module)
def perform() do
@my_collaborating_module.do_something()
end
end
require "uri"
require "http/client"
require "file_utils"
print "🤖 Fetching sentry files..."
# Fetch sentry.cr
sentry_uri = "https://raw.githubusercontent.com/samueleaton/sentry/49a9a9cf1cdd87f0156206322df198c988132b6f/src/sentry.cr"
fetch_sentry_response = HTTP::Client.get sentry_uri
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 23, 2024 21:53
Conventional Commits Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@intrnl
intrnl / usefetch.js
Last active November 24, 2023 04:26
import { useState, useEffect } from 'preact/hooks'
/**
* @param {RequestInfo} url
* @param {RequestInit} opts
* @returns {useFetchObject}
*/
function useFetch (url, opts) {
const [response, setResponse] = useState(undefined)
const [error, setError] = useState(undefined)