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
@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 / 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>"
}
// 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 / 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

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>
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);
@guillaumegarcia13
guillaumegarcia13 / postgres-cheatsheet.md
Created June 10, 2016 16:13 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@guillaumegarcia13
guillaumegarcia13 / get-watchers.js
Created June 9, 2016 09:11 — forked from kentcdodds/get-watchers.js
Get Watchers of element and its children
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@guillaumegarcia13
guillaumegarcia13 / Apprendre JS correctement.md
Created April 19, 2016 09:54 — forked from tdd/Apprendre JS correctement.md
Quelques ressources valables pour (ré)apprendre JS correctement