Skip to content

Instantly share code, notes, and snippets.

Aymeric Aymkdn

Block or report user

Report or block Aymkdn

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
Aymkdn / linkify
Created Jun 5, 2018
Parse URL in a string and convert in a link
View linkify
var urlRegex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
function linkify(text, safeText) {
safeText = (safeText===false? false : true);
if (safeText) text=escapeHtml(text);
return text.replace(urlRegex, function(url) {
return '<a href="' + url + '">' + url + '</a>';
Aymkdn / notifier.js
Last active Nov 14, 2017
Have Google Home to speak
View notifier.js
// npm install castv2-client google-tts-api
var Client = require('castv2-client').Client;
var client = new Client();
var DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver;
var GoogleTTS = require('google-tts-api');
var host = ""; // IP Address of the Google Home
var text = "Bonjour et bienvenue"; // Text to speach
var lang = "fr-FR"; // language
GoogleTTS(text, lang, 1)
.then(function(url) {
View htmlstring.xml
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="">
<author>Todd Vierling</author>
<description>HTML selector that returns a flat, escaped string rather than a node tree. Suitable for use with Pipes and other applications wishing to embed HTML in another XML-like container.</description>
<sampleQuery>select * from {table} where url='' and xpath='//a'</sampleQuery>
<select itemPath="" produces="XML">
Aymkdn / jsonpost.xml
Last active Jan 2, 2019
Post JSON using YQL Open Table
View jsonpost.xml
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="">
<author>Johannes Charman</author>
<description>JSON pages that need post data (this table is based on htmlpost by Christian Heilmann)</description>
<sampleQuery>select * from {table} where url='' and postdata="q=test"</sampleQuery>
<select itemPath="" produces="XML">
Aymkdn / CompareLibrairies.js
Created May 18, 2017
Use node to compare two Sharepoint librairies and copy the source to the destination. It will create the folders and files, but it will also update the Modified date and Modifier author in the destination to match the source
View CompareLibrairies.js
// Command: node index.js "" ""
if (process.argv.length !== 4) throw "ERROR: please provide the source and the destination on the command line";
const colors = require('colors');
// load credentials
const credentials = require('../credentials');
const $SP = require('sharepointplus');
const sp = $SP().auth(credentials);
var requestdigest = '';
// contains the references to the items to update in the dest lib
Aymkdn / Date.parseFrom.js
Created Jan 30, 2017
Date.parseFrom() permits to parse a string to a JavaScript Date
View Date.parseFrom.js
* Parse a string to a Date
* @param {String} strDate
* @param {String} format Supported format including YYYY, YY, MM, M, DD, D, with - and / separators
* @return {Date|Throw} the JS Date object, or throw Error("Invalid Date") if strDate is invalid
* @compatibility IE9+
* @example
* Date.parseFrom("1/10/2017", "MM/DD/YYYY"); // -> new Date(2017,0,10)
Date.parseFrom=function(strDate, format) {
Aymkdn / loadExt.js
Last active Jan 28, 2020
To load JS and CSS files with vanilla JavaScript
View loadExt.js
// long version
function loadExt(files, after) {
var _this=this;
_this.files = files;
_this.js = [];
_this.head = document.getElementsByTagName("head")[0];
_this.after = after || function(){};
_this.loadStyle = function(file) {
var link = document.createElement("link");
link.rel = "stylesheet";
Aymkdn / method1a.js
Last active Oct 27, 2016
Examples to retrieve a manager in Sharepoint 2013
View method1a.js
// Retrieve Manager for a username
// using REST API
var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
var accountName = 'domain\\login';
// I suppose you use jQuery
url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(accountName) + "'",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
Aymkdn / multiple_approve.js
Created Sep 15, 2016
Multiple Approve/Reject in Sharepoint 2010 (jQuery + approval.js)
View multiple_approve.js
/*! jQuery v3.1.0 | (c) jQuery Foundation | */
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,,o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.p
Aymkdn / tiny_http.js
Created Jul 12, 2016
Tiny HTTP Get/Post
View tiny_http.js
m: method ("get", "post")
u: url
c: callback (with 'xhr' as a parameter)
a: async (true / default) or sync (false)
d: post_data (the data to post)
function tiny_http(m,u,c,a,d){var _xhr=new(this.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");with(_xhr)onreadystatechange=function(){4^readyState||c(_xhr)},open(m,u,a),"post"===m.toLowerCase()?setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"):"",send(d)}
You can’t perform that action at this time.