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 / Sample.java
Created February 22, 2017 03:06
Read body of HttpURLConnection as String
package com.ibm.sample;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Sample {
@nacho4d
nacho4d / myproject_pom.xml
Last active February 17, 2017 16:21
myproject/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- THIS PRODUCT CONTAINS RESTRICTED MATERIALS OF IBM 5724-H88, 5724-J08,
5724-I63, 5655-W65, COPYRIGHT International Business Machines Corp., 2014
All Rights Reserved * Licensed Materials - Property of IBM US Government
Users Restricted Rights - Use, duplication or disclosure restricted by GSA
ADP Schedule Contract with IBM Corp. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<licenses>
@nacho4d
nacho4d / .emacs
Last active November 22, 2016 12:06
My emacs configuration ...
;; Add ~/.elisp directory to my load path.
;; Not needed since .emacs.d is read by default
(add-to-list 'load-path' "~/.emacs.d")
;; Show trailing white spaces
(setq-default show-trailing-whitespace t)
(set-face-background 'trailing-whitespace "#191970")
;; Adds Other Package manager repositories
(require 'package)
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("GIT_SSL_NO_VERIFY: %s\n", getenv("GIT_SSL_NO_VERIFY"));
if (getenv("GIT_SSL_NO_VERIFY"))
printf("evaluated as TRUE\n");
else
printf("evaluated as FALSE\n");
@nacho4d
nacho4d / server.xml
Last active August 29, 2016 02:54
My server.xml
<server description="Liberty beta">
<featureManager>
<!-- To enable Swagger -->
<feature>apiDiscovery-1.0</feature>
<!-- Default stuff -->
<feature>webProfile-7.0</feature>
<feature>adminCenter-1.0</feature>
@nacho4d
nacho4d / exampleJson.js
Created August 3, 2016 13:48
javax.json is too much hassle
{
keyString: "String",
keyBoolean: true,
keyArraySimple: [
1,
11,
111
],
keyArrayObject: [
{
@nacho4d
nacho4d / exampleJavaxJson.java
Created August 3, 2016 13:47
javax.json is too much hassle
JsonObject json = Json.createObjectBuilder()
.add("keyString", "string")
.add("keyBoolean", true)
.add("keyArraySimple", Json.createArrayBuilder()
.add(1)
.add(11)
.add(111).build())
.add("keyArrayObject", Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("lang", "ja")
@nacho4d
nacho4d / NSTask sample
Created April 8, 2012 13:25
NSTask sample
#import <Foundation/Foundation.h>
void doTaskAndCapture(void);
void doTaskAndCapture()
{
@try
{
// Set up the process
NSTask *t = [[[NSTask alloc] init] autorelease];
[t setLaunchPath:@"/bin/ls"];
@nacho4d
nacho4d / leakingSingleton.m
Last active December 31, 2015 20:28
leaking vs non-leaking singleton
// LEAKING
@implementation CandidatesWindow
CandidatesWindow *sharedInstance = nil;
- (id)initWithFrame:(CGRect)frame
{
if (sharedInstance) {
sharedInstance.frame = frame;
} else {
sharedInstance = [super initWithFrame:frame];
}
@nacho4d
nacho4d / twilight.unity.theme.xml
Last active December 29, 2015 20:00
Another twilight theme but this time for monodevelop (unity) Preview: (link tweet with an image) https://twitter.com/nacho4d/status/406833668783493120
<EditorStyle name="Twilight" _description="Twilight, the TextMate theme">
<!-- Color palette -->
<Color name="tl.general.selection" value="#545454" /> <!-- light gray -->
<Color name="tl.general.background" value="#252525" /> <!-- *light* black -->
<Color name="tl.general.background.dark" value="#191919" /> <!-- not so light black -->
<Color name="tl.plainText" value="#CDCDCD" /> <!-- light gray -->
<Color name="tl.comments" value="#3FA41C" /> <!-- green -->
<Color name="tl.strings" value="#A0AB7F" /> <!-- lime -->
<Color name="tl.sharactersAndNumbers" value="#786DC4" /> <!-- purple -->
<Color name="tl.keywords" value="#C31265" /> <!-- pink-->