Skip to content

Instantly share code, notes, and snippets.

View nacho4d's full-sized avatar

Guillermo Ignacio Enriquez Gutierrez nacho4d

View GitHub Profile
@nacho4d
nacho4d / launch.json
Created August 23, 2016 07:50
.vscode/launch.json for Google Chrome Canary
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html",
"userDataDir": "${workspaceRoot}/out/chrome",
"runtimeExecutable": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
@nacho4d
nacho4d / JsonUtils.java
Last active May 19, 2021 15:16
Because javax.json.Json is just too much hassle
package com.company.project.util;
import java.io.StringReader;
import java.io.StringWriter;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonWriter;
// Created by Guillermo Enriquez on 09/10/2012.
// Copyright 2012 nacho4d. All rights reserved.
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, @"Application", @"AppDelegate");
[pool drain];
return retVal;
}
@nacho4d
nacho4d / Daemon in OSX Example
Created April 8, 2012 17:06
Daemon in OSX Example
#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
# pragma mark Daemon Protocol
@protocol DaemonProtocol
- (void)performWork;
@end
# pragma mark MyTask Object Conforms to Protocol
@nacho4d
nacho4d / config.fish
Created March 4, 2019 10:05
My ~/.config/fish/config.fish
set -x LANGUAGE en_US.UTF-8
set -x LANG en_US.UTF-8
set -x LC_ALL en_US.UTF-8
set -x LESSCHARSET utf-8
# Dark terminal
set -Ux LSCOLORS gxfxbEaEBxxEhEhBaDaCaD
# Java Stuff
set -x JAVA_HOME (/usr/libexec/java_home -v 1.8)
@nacho4d
nacho4d / .hyper.js
Created February 11, 2019 12:46
hyper terminal configuration file
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@nacho4d
nacho4d / URLRequest + CurlCommand.swift
Created December 11, 2018 15:12
extension to print an NSURLRequest as a curl command (ready to be copy and pasted onto terminal, etc)
extension URLRequest {
/// Internal helper function to escape double quotes
func curlEscapeQuotes(in string: String) -> String {
return string.replacingOccurrences(of: "\"", with: "\\\"")
}
/// Curl Command string
var curlCommand: String {
guard let url = url else {
return "# No URL found"
@nacho4d
nacho4d / BasicAuthenticationFilter.java
Last active July 12, 2018 18:15 — forked from neolitec/BasicAuthenticationFilter.java
HTTP Basic authentication Java filter (Without external dependencies)
package com.company.project.filter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
@nacho4d
nacho4d / BinaryDelegate.swift
Last active May 5, 2018 08:12
Delegate class to be used with MFP8 iOS SDK -[WLResourceRequest sendWithDelegate:] method
//
// BinaryDelegate.swift
// BinaryResponse
//
// Based on Nathan Hazout's BinaryDelegate
//
// https://github.com/nasht00/MFPBinaryResponse/blob/master/ios/BinaryResponse/BinaryResponse/BinaryDelegate.swift
//
import UIKit
@nacho4d
nacho4d / git-lint
Last active August 18, 2017 03:31
use swiftlint to lint only modified or stagged files
#! /bin/bash
# Usage:
# Place this file somewhere in your PATH (and make sure it is executable) then call it like `git lint`
# Check swiftlint
command -v swiftlint >/dev/null 2>&1 || { echo >&2 "git-lint requires swiftlint but it's not installed. Aborting."; exit 1; }
# Create a temp file
temp_file=$(mktemp)