Skip to content

Instantly share code, notes, and snippets.

JGWill jgwill

Block or report user

Report or block jgwill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jgwill
jgwill / git-save-credential-http.sh
Created May 21, 2019
GIT Bash - credentials - How to save username and password in GIT?
View git-save-credential-http.sh
# credentials - How to save username and password in GIT? - Stack Overflow
#Run :
git config credential.helper store
#then
git pull
@jgwill
jgwill / count-files-bash.aliases.sh
Last active May 12, 2019
Count files in the current dir
View count-files-bash.aliases.sh
#@STCGoal Count files in the current dir
alias countfiles="du -a . | wc -l"
@jgwill
jgwill / bash-command-not-installed.sh
Created Apr 29, 2019
Echo a command was not found in the BASH environment
View bash-command-not-installed.sh
#!/bin/bash
command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }
@jgwill
jgwill / dropbox-file-from-url.js
Created Apr 28, 2019
A File URL is posted to the CHAT in the Resolution Field and the server render the content to the browser with the file content
View dropbox-file-from-url.js
//@cr A File URL is posted to the CHAT in the Resolution Field and the server render the content to the browser with the file content
var fetch = require('isomorphic-fetch'); // or another library of choice.
var fs = require('fs');
var Dropbox = require('dropbox').Dropbox;
var token = process.env.DROPBOX_TOKEN;
var dbx = new Dropbox({ accessToken: token, fetch: fetch });
var annoter_file = "9c6a35efe357580f32e759908430643d.annoter.txt";
var annoter_folder_path = '/x/_/_db/annoter';
var annoter_file_path = annoter_folder_path + '/' + annoter_file;
View dropbox-url-from-file.js
//@cr A File URL is posted to the CHAT in the Resolution Field and the server render the content to the browser with the file content
var fetch = require('isomorphic-fetch'); // or another library of choice.
var fs = require('fs');
var Dropbox = require('dropbox').Dropbox;
var token = process.env.DROPBOX_TOKEN;
var dbx = new Dropbox({ accessToken: token, fetch: fetch });
var annoter_file = "9c6a35efe357580f32e759908430643d.annoter.txt";
var annoter_folder_path = '/x/_/_db/annoter';
var annoter_file_path = annoter_folder_path + '/' + annoter_file;
@jgwill
jgwill / x-markdown-handlebars-helpers-example.js
Created Apr 15, 2019
@stcgoal That we can use Markdown into Templates data that will be rendered as HTML
View x-markdown-handlebars-helpers-example.js
//import
var h = require('handlebars');
//@stcgoal That we can use Markdown into Templates data that will be rendered as HTML
h.registerHelper('markdown', require('helper-markdown'));
//-------------------------------------------
//@STCGoal Use Markdown in your Code to Render it as HTML
@jgwill
jgwill / x-helper-handlebars-example.js
Last active Apr 15, 2019
Register an Helper for the Handlebars rendering
View x-helper-handlebars-example.js
//import
var h = require('handlebars');
//Register an Helper for the Handlebars rendering
h.registerHelper('list',function(items,options)
{
var out = `
<table>
<tr><td>Name</td><td>Note</td></tr>`;
items.forEach(element => {
@jgwill
jgwill / Mastery-HandleBars.md
Last active Apr 15, 2019
Mastery HandleBars - NodeJS
View Mastery-HandleBars.md

Mastery HandleBars

Simple Handlebars example

//import
var h = require('handlebars');

//Handlebars sources
var code = `
@jgwill
jgwill / x-translating-using-google-translate-api.js
Last active Apr 11, 2019
Simple Translation using Google Translate API and NodeJS
View x-translating-using-google-translate-api.js
//Install require an env var with your API keys
//export GOOGLE_APPLICATION_CREDENTIALS="/home/jgi/x/etc/mykeys-5oeu3uoeu.json"
// Imports the Google Cloud client library
const {Translate} = require('@google-cloud/translate');
// Instantiates a client
const translate = new Translate({
});
@jgwill
jgwill / dummy.json
Last active Apr 11, 2019
@stcgoal Optimal Management of JSON Files
View dummy.json
{
"name": "transapp",
"version": "0.0.1",
"description": "Master the Translate API to create. string Hello world is adde to each lang located in the i18n directory using the translator",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Guillaume Isabelle",
You can’t perform that action at this time.