Skip to content

Instantly share code, notes, and snippets.

guibot17 guibot17

Block or report user

Report or block guibot17

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
@guibot17
guibot17 / app.get
Created Mar 21, 2019 — forked from tmamedbekov/app.get
Simple readdir with express server. NODE.JS
View app.get
var express = require('express');
var fs = require('fs');
var app = express();
app.get('/logJson', function (req, res) {
const logsFolder = '/folder/path/';
fs.readdir(logsFolder, (err, files) => {
if (err) {
@guibot17
guibot17 / user.js
Created Feb 22, 2019 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
View user.js
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@guibot17
guibot17 / JSON with JS.md
Created Feb 21, 2019 — forked from laurenancona/JSON with JS.md
Access local JSON data with Javascript
View JSON with JS.md

What

An updated guide/collection of guides on how to access JSON data with JavaScript

Original Question on Stack Exchange.


Example 1

For reading the external Local JSON file (data.json) using java script

View gist:5d352b191dc596d6ec44571695a167ae
{
"countries": [
{
"country": "Afghanistan",
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"]
},
{
"country": "Albania",
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"]
},
@guibot17
guibot17 / README.md
Created Apr 27, 2018 — forked from lopspower/README.md
Hexadecimal color code for transparency
View README.md

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@guibot17
guibot17 / what-forces-layout.md
Created Dec 23, 2017 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@guibot17
guibot17 / sample.html
Created Dec 21, 2017 — forked from guillaumegarcia13/sample.html
Angular 4 ng-template & ng-container with parameters
View sample.html
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
@guibot17
guibot17 / snap-to-grid.js
Created Dec 7, 2017 — forked from caleb531/snap-to-grid.js
Makes a jCanvas layer draggable along a defined grid
View snap-to-grid.js
// Available in jCanvas v20.1.0
// The pixel multiple to snap to
var snapToAmount = 40;
// Round the given value to the nearest multiple of n
function nearest(value, n) {
return Math.round(value / n) * n;
}
$('canvas').drawArc({
layer: true,
@guibot17
guibot17 / audio-api-wrapper.ts
Created Nov 11, 2017 — forked from devfred/audio-api-wrapper.ts
Typescript: HTML5 Audio Wrapper for angular2
View audio-api-wrapper.ts
/**
* @class
* @description
* Wrapper for HTML5 audio.
*/
import {Injectable, NgZone} from 'angular2/core';
import {Observer} from 'rxjs/Observer';
import {Observable} from 'rxjs/Observable';
declare var AudioContext:any;
View rxjs_operators_by_example.md
You can’t perform that action at this time.