Skip to content

Instantly share code, notes, and snippets.

View trajano's full-sized avatar
🖖
https://t.me/s/tracer_needs_a_buff

Archimedes Trajano trajano

🖖
https://t.me/s/tracer_needs_a_buff
View GitHub Profile
// drop and insert data
db.books.drop();
db.books.insert({
"title": "End to End Enterprise Architecture",
"authors": ["Archimedes Trajano"]
});
db.books.insert({
"title": "Deadpool: The Proper Screenplay",
"authors": ["Archimedes Trajano",
"Will Wheaton",
@trajano
trajano / ZXingTest.java
Created June 1, 2013 12:12
Creating a QR Code using ZXING
import java.io.FileOutputStream;
import java.io.IOException;
import org.junit.Test;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Writer;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
@trajano
trajano / gist:5941038
Created July 6, 2013 19:50
Snipet of manifest-update
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>update-manifest</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
@trajano
trajano / gist:9626235
Created March 18, 2014 18:24
NonRelativizingDecorationModelInheritanceAssembler
package net.trajano.maven.doxia.site.decoration.inheritance;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@trajano
trajano / preload-double-download.html
Last active April 4, 2017 21:25
This will cause a double download of JQuery in Chrome
<html>
<head>
<link rel="preload" href="//code.jquery.com/jquery-2.2.4.min.js" as="script" crossorigin />
</head>
<body>
Load me up in <a href="http://rawgit.com/trajano/a61654502d4aa6191d742766f87dc5fe/raw/4aaa942f8457513d60fd1a26d953fd847b2aaea2/preload-double-download.html">Rawgit</a> don't forget to enable developer console to see the warnings.
<script src="//code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
</body>
@trajano
trajano / keybindings.json
Created April 28, 2017 14:54
Archie's Visual Studio Code Settings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+f",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+f",
"command": "-editor.action.formatDocument",
@trajano
trajano / trajano.json
Last active October 25, 2018 05:03
Karabiner Personal Rules
{
"title": "Personal Rules (@trajano)",
"author": "Archimedes Trajano",
"rules": [
{
"description": "Fn+Shift+Esc Opens Activity Monitor",
"manipulators": [
{
"type": "basic",
"from": {
@trajano
trajano / HtmlToPdf.java
Last active November 21, 2018 14:01
PDFBOX-3903
import com.openhtmltopdf.DOMBuilder;
import com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder;
import com.openhtmltopdf.pdfboxout.PdfRendererBuilder;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@trajano
trajano / main.cpp
Last active January 13, 2019 19:09
C++ Singleton
#include <iostream>
#include "singleton.h"
int main()
{
std::cout << "Hello World!" << std::endl;
std::cout << Singleton::instance().singletonMethod() << std::endl;
}
@trajano
trajano / DockerSwarmDiscoveryClient.java
Last active February 9, 2019 19:30
Docker Swarm Discovery Client
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.annotation.Order;
import org.springframework.http.MediaType;