Skip to content

Instantly share code, notes, and snippets.

View nguyenvanduocit's full-sized avatar
🌴
On vacation

Duoc Nguyen nguyenvanduocit

🌴
On vacation
View GitHub Profile
<style type="text/css" media="print">
* { display: none; }
</style>
document.getElementById('myImage').setAttribute('draggable', false)
function disableRightMouse(e){
if((myevent.button==2)||(myevent.button==3)) return false;
}
document.addEventListener('contextmenu', event => event.preventDefault())
document.onmousedown = disableRightMouse;
document.onmouseup = disableRightMouse;
@nguyenvanduocit
nguyenvanduocit / MusicPlayer_AudioPlayer.vue
Created September 6, 2019 03:46
SoundWave and AudioPlayer Animation
<template>
<audio
ref="audio"
src="/audio/magical.mp3"
preload="auto"
loop
@canplaythrough="audioLoaded"
>
<p>If you are reading this, it is because your browser does not support the audio element.</p>
</audio>
@nguyenvanduocit
nguyenvanduocit / docker-compose.yaml
Created July 11, 2019 01:46
Docker compose file for owncloud
version: '2.1'
volumes:
files:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/Users/duocnguyen/Tmp/owncloud-docker-server/files'
mysql:
class GradientButton extends StatelessWidget {
static const Color loginGradientStart = const Color(0xFFfbab66);
static const Color loginGradientEnd = const Color(0xFFf7418c);
static const LinearGradient primaryGradient = const LinearGradient(
colors: [loginGradientStart, loginGradientEnd],
stops: [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
);
// interviewer: what will the following code output?
const arr = [10, 12, 15, 21];
for (var i = 0; i < arr.length; i++) {
setTimeout(function() {
console.log('Index: ' + i + ', element: ' + arr[i]);
}, 3000);
}
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
import 'package:flame/flame.dart';
import 'package:flutter/material.dart';
class ButtonStyle {
final Color topColor;
final Color backColor;
const ButtonStyle({@required this.topColor, @required this.backColor});
static const DEFAULT = const ButtonStyle(
topColor: const Color(0xFF45484c),
backColor: const Color(0xFF191a1c)
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flame/flame.dart';
class ButtonStyle {
final Color topColor;
final Color backColor;
const ButtonStyle({@required this.topColor, @required this.backColor});
static const DEFAULT = const ButtonStyle(
topColor: const Color(0xFF45484c),