Skip to content

Instantly share code, notes, and snippets.

@munirwanis
munirwanis / index.js
Created February 20, 2018 20:40 — forked from MoOx/index.js
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@munirwanis
munirwanis / showWarningsXcode.sh
Created January 12, 2018 20:38
Show warnings on Xcode
TAGS="TODO:|FIXME:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@munirwanis
munirwanis / estados-cidades.json
Created December 23, 2017 14:08 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@munirwanis
munirwanis / ArrayExtension.swift
Created December 9, 2017 18:50
Reduce String array to a single String separated by new lines.
extension Sequence where Iterator.Element == String {
var reduced: String {
return self.reduce("", { $0 == "" ? $1 : $0 + "\n" + $1 })
}
}
@munirwanis
munirwanis / LocaleExtension.swift
Last active December 8, 2017 00:52
Used to bring all country names directly from NSLocale
//
// LocaleExtension.swift
//
//
// Created by Munir Wanis on 02/11/17.
// Copyright © 2017 Munir Xavier Wanis. All rights reserved.
//
import Foundation
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@munirwanis
munirwanis / get_cocoapods_token.sh
Last active June 19, 2017 17:05
iOS Development helpers
# Search for token
pod trunk me --verbose
# or use this command instead
cat ~/.netrc
# will result:
# machine trunk.cocoapods.org
# login user@example.com
# password 0000000011111111
using System.Linq;
using System.Collections.Generic;
public static class Groups
{
// "()" "{}" or "[]"
private static Dictionary<char, char> matches = new Dictionary<char, char> {
{ '(', ')' },
{ '{', '}' },
{ '[', ']' },
};
@munirwanis
munirwanis / quote_comma.sublime-macro
Created November 14, 2016 16:30
Every time you want to run queries on SQL and have a lot of items without the ' ', caracteres you can run this macro on sublime and it'll do the job
[
{
"command": "select_all"
},
{
"command": "split_selection_into_lines"
},
{
"args": {
"extend": false,
// A variável de entrada pode ser qualquer outra coisa, ou nada, é só trocar o item abaixo
// Função para montar o body do email
public string GetMailBody(List<T> resultToMail) {
var body = new StringBuilder();
body.AppendLine("<html><head>");
body.AppendLine(@"<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}