Skip to content

Instantly share code, notes, and snippets.

View guillaumegarcia13's full-sized avatar
💭
Building awesome things 🚀

GARCIA Guillaume guillaumegarcia13

💭
Building awesome things 🚀
View GitHub Profile
import java.util.Map.Entry;
import java.util.TreeMap;
// See http://stackoverflow.com/a/13400317/611182
public class Main {
private static TreeMap<Double, String> m = new TreeMap<Double, String>();
static {
m.put(1.0, "A");
m.put(2.9, null);

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@guillaumegarcia13
guillaumegarcia13 / port_forward.bat
Last active August 25, 2016 18:08
SSH Tunnel with Port Forwarding
:: Use this Windows BATCH file to perform SSH Tunneling with Port Forwarding to your local PC
::
:: Explanations of the command line switches
:: -ssh Connects through SSH
:: -P Port to which you connect on the remote server
:: -pw Password to connect with
:: -L Forwards local portal to remote destination
:: -N (always at the end) Do NOT start a shell
:: Example
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@guillaumegarcia13
guillaumegarcia13 / build.gradle
Created November 20, 2016 14:05
Gradle on WIndows: Error 206
task bootRun206_clean(dependsOn: clean) { }
task bootRun206_jar(dependsOn: jar) { }
task bootRun206_bootRepackage(dependsOn: bootRepackage) { }
task bootRun206_run(type: JavaExec) {
description = "Circumvent the error 206 on Windows due to long command line"
classpath = files('build/libs/<output name>.jar')
classpath += sourceSets.main.runtimeClasspath
main = "com.example.<main class>"
}
@guillaumegarcia13
guillaumegarcia13 / gist:a334b29b294ec587f9d5f13118c70a66
Created December 8, 2016 11:36 — forked from devinus/gist:415179
Turn CSS rules into inline style attributes using jQuery
(function ($) {
var rules = document.styleSheets[document.styleSheets.length-1].cssRules;
for (var idx = 0, len = rules.length; idx < len; idx++) {
$(rules[idx].selectorText).each(function (i, elem) {
elem.style.cssText += rules[idx].style.cssText;
});
}
$('style').remove();
$('script').remove();
})(jQuery);
@guillaumegarcia13
guillaumegarcia13 / count.cypher
Created December 29, 2016 16:51
Neo4j: Count all relations per node types
MATCH (n)-[r]->(m)
WITH HEAD(LABELS(n)) AS label_n, type(r) as type_r, HEAD(LABELS(m)) AS label_m
RETURN type_r, label_n, label_m, COUNT(*)
ORDER BY type_r
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
@guillaumegarcia13
guillaumegarcia13 / html_forms_cheatsheet.md
Created April 4, 2017 12:21
HTML forms and input tags cheatsheet. All you need to know to write every HTML form possible, including links to good resources on HTML and the new HTML5 form and input options...

HTML Forms

In order that you never go to W3Schools (never go there), here is a basic cheat sheet for writing simple HTML forms.

This is culled from a few sources, [the most important being MDN][MDN]. MDN (the Mozilla Developer Network) should be seen as "the docs" when you are having an issue with HTML.

public class JSONUtils {
//-------------
// DATA
//-------------
static public ObjectMapper objectMapper = new ObjectMapper();
//-------------
// METHODS