Skip to content

Instantly share code, notes, and snippets.

View ducdigital's full-sized avatar
🏠
Need an engineer? Drop me an email!

Ta Duy Duc ducdigital

🏠
Need an engineer? Drop me an email!
View GitHub Profile

4. Changez la couleur du texte "J'adore la programmation" en rose en utilisant du CSS.

<div>
   <p class="rose">J'adore la programmation</p>
</div>
@ducdigital
ducdigital / bluetooth-lock.sh
Created December 7, 2018 12:27
Auto-lock your KDE when bluetooth device disconnected
#!/bin/bash
isLocked=false
macaddress=00:00:00:00:00:00
while true; do
connected=$(bluetoothctl connect $macaddress)
if [[ $connected == *"org.bluez.Error.Failed"* ]]; then
if $isLocked; then
sleep 5
@ducdigital
ducdigital / axios-cancellation.js
Created May 29, 2018 15:24
Sample of React component that allow cancel axios ajax call when unmount
class SampleCancellableAjax extends Component {
constructor(props) {
super(props);
/* Ajax handlers */
this._cancelToken = CancelToken.source();
}
componentDidUpdate() {
@ducdigital
ducdigital / hocFlowRight.js
Created May 31, 2017 10:17
Simple HOC component with lodash flowRight
let Component = {};
_.flowRight([
function helpers(extradata) {
return function (Component) {
console.log('helpers component', Component);
Component.helpers = 'passedHelpers';
Component.extradata = extradata;
return Component;

Keybase proof

I hereby claim:

  • I am ducdigital on github.
  • I am ducdigital (https://keybase.io/ducdigital) on keybase.
  • I have a public key ASAm1gtlkSBej7EAUJ1j7W9SDWLaaLmHNKRXbnbweT0RiAo

To claim this, I am signing this object:

@ducdigital
ducdigital / index.html
Created December 9, 2016 14:50 — forked from ThomasFlorelli/index.html
Dont start by the end #jsbench #jsperf (http://jsbench.github.io/#1327ac9784eebd16dde0729732e1f871) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Dont start by the end #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
/*
* @file Mongoose inherit sub-schemas components test
* @copyright Copyright (c) LaBelleAssiette 2015. All rights reserved.
*/
'use strict';
var expect = require('chai').expect;
var should = require('chai').should();
var mongoose = require('mongoose');
var _ = require('lodash');
@ducdigital
ducdigital / gist:19a2d5b4073a51fd541d
Created April 17, 2015 08:03
Maping price to a priceIndex
var index, pppClient, currencyPrice;
pppClient = _.find(menu.fixedPriceMapClient, function (price) {
return price.from <= 6 && price.to >= 6;
});
currencyPrice = menuPrices[menu.currency];
if (!!pppClient) {
index = _.findIndex(currencyPrice, function (v,index) {
if (typeof currencyPrice[index+1] === 'undefined') {