Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
SYMBOLICATE="/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash"
for f in "$@"
do
SRCNAME=$(echo $(basename "${f}"))
SRCPATH=$(echo $(dirname "${f}"))
DSTPATH="${SRCPATH}/${SRCNAME%.*}.symbolicated.ips"
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@castwide
castwide / rails.rb
Last active April 27, 2024 08:54
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@dhavalmetrani
dhavalmetrani / sem_ver.sh
Created March 10, 2019 08:45
Bash script to manage semantic versioning and push to git [ <major>.<minor>.<patch> ]
#!/usr/bin/env sh
# Semantic versioning details: https://semver.org/
# Constants
RELEASE_PATCH="release-patch"
RELEASE_MINOR="release-minor"
RELEASE_MAJOR="release-major"
# Command line arguments.
if [ ${#} -lt 2 ];
@IanKeen
IanKeen / DictionaryDecoder.swift
Created March 1, 2019 18:43
DictionaryDecoder
import Foundation
class DictionaryDecoder {
init() { }
func decode<T: Decodable>(_ type: T.Type, from data: [String: Any]) throws -> T {
let decoder = _Decoder(codingPath: [], source: data)
return try T(from: decoder)
}
}
@IanKeen
IanKeen / DictionaryEncoder.swift
Last active May 4, 2021 14:36
DictionaryEncoder for Encodable types
class DictionaryEncoder {
init() { }
func encode(_ value: Encodable) throws -> [String: Any] {
let encoder = _Encoder(codingPath: [])
try value.encode(to: encoder)
guard let result = encoder.value as? [String: Any] else {
throw EncodingError.invalidValue(encoder.value as Any, .init(codingPath: [], debugDescription: "Invalid root container"))
}
@maoueh
maoueh / main.go
Last active December 20, 2023 01:04
golang gorilla mux sub/router + specific middleware per subrouter
package main
import (
"time"
"fmt"
"net/http"
"github.com/gorilla/mux"
)
func main() {
@nathantannar4
nathantannar4 / Reflectable.swift
Created December 17, 2018 22:17
Generate JSON representation of values using the Mirror API
//
// Reflectable.swift
//
// Created by Nathan Tannar on 2018-12-04.
//
import Foundation
// Add this protocol to your `struct` or `class`
protocol Reflectable {
import UIKit
typealias Constraint = (_ child: UIView, _ other: UIView) -> NSLayoutConstraint
func equal<Axis, Anchor>(_ keyPath: KeyPath<UIView, Anchor>, constant: CGFloat = 0, priority: UILayoutPriority = .required) -> [Constraint] where Anchor: NSLayoutAnchor<Axis> {
return equal(keyPath, keyPath, constant: constant, priority: priority)
}
func equal<Axis, Anchor>(_ keyPath: KeyPath<UIView, Anchor>, _ toAnchor: KeyPath<UIView, Anchor>, constant: CGFloat = 0, priority: UILayoutPriority = .required) -> [Constraint] where Anchor: NSLayoutAnchor<Axis> {
return [{ view, other in
@giautm
giautm / hashcode.go
Created October 26, 2018 13:50
Golang implement of `java.lang.String` hashCode() https://en.wikipedia.org/wiki/Java_hashCode()
package hashcode
import "hash"
const Size = 4
func NewHash() hash.Hash32 {
var s sum32 = 0
return &s
}