Skip to content

Instantly share code, notes, and snippets.

@christophercurrie
christophercurrie / Polymorph.java
Created February 11, 2014 17:20
Example of Polymorphic Deserialization using Jackson
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value=AudioAttachment.class, name="audio"),
@JsonSubTypes.Type(value=LinkAttachment.class, name="link")
@gitaarik
gitaarik / git_submodules.md
Last active June 8, 2024 10:16
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@franz-josef-kaiser
franz-josef-kaiser / ajax.js
Last active May 31, 2022 15:53
AJAX in WordPress. Class based example.
( function( $, plugin ) {
"use strict";
// Working with promises to bubble event later than core.
$.when( someObjectWithEvents ).done( function() {
console.log( 'AJAX request done.' );
} )
.then( function() {
setTimeout( function() {
console.log( 'AJAX requests resolved.' );
@LunaCodeGirl
LunaCodeGirl / examples.sh
Created September 25, 2013 23:39
Figlet how to and examples
figlet "I've got something to say"
figlet -f thick "Make Tech ASCIIer"
date | figlet -f basic
@fernando-basso
fernando-basso / proxy.bash
Last active April 25, 2023 06:43
Proxy functions. Place them in $HOME/.bashrc or in a differente file, and then source it from bashrc, or source it manually when needed. The file extension is merely illustrative.
#!/usr/bin/env bash
# gsettings list-recursively org.gnome.system.proxy
# Change de ip address and port number accordingly.
function myProxyOn() {
gsettings set org.gnome.system.proxy mode 'manual' # ' manual / nome / automatic '
gsettings set org.gnome.system.proxy.http host '10.0.0.1'
gsettings set org.gnome.system.proxy.http port 8080
gsettings set org.gnome.system.proxy.https host '10.0.0.1'
@samarpanda
samarpanda / Debugging_Nginx.md
Last active March 16, 2020 13:24
Debugging Nginx Configuration!

Debugging Nginx Configuration

  • Set Nginx log-level to debug

    server {  
      error_log /var/logs/nginx/samar.error.log  debug;  
    }  
    # Word of caution: Don't forget to revert debug-level for error_log on a *very* high traffic site.  
@I3rixon
I3rixon / Main.java
Created July 29, 2013 00:46
pretty output of hexdump like in Java
public static void prettyOut(byte[] msg) {
for (int j = 1; j < msg.length+1; j++) {
if (j % 8 == 1 || j == 0) {
if( j != 0){
System.out.println();
}
System.out.format("0%d\t|\t", j / 8);
}
System.out.format("%02X", msg[j-1]);
if (j % 4 == 0) {
package test.weldtest;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
public class App {
public static void main(String[] args) {
WeldContainer weld = new Weld().initialize();
weld.instance().select(HelloWorldWriter.class).get().sayIt();
}
@MicahElliott
MicahElliott / demo.txt
Created January 13, 2012 22:10
Display all the possible toilet fonts for a string.
banner
### ###
# # # # # ###### ## #### #### # # ###
# # # # # # # # # # # # # ###
# # # #### ##### # # #### # # # #
# # # # # # ###### # # # #
# # # # # # # # # # # # # # ###
### ###### # # # ###### # # #### #### # # ###
@ticean
ticean / SVN_Git_Mirror.md
Created January 3, 2012 21:14
SVN Git Mirror

Create Git Mirror from SVN Repository

This guide will demonstrate how to mirror an SVN into a Git repo. You're the target audience if you're an SVN user, just getting started with Git and need to coax your project team over to Git.

The branching scenario has been simplified for clarity.

References