Skip to content

Instantly share code, notes, and snippets.

View doxhung's full-sized avatar
:octocat:
Working on Appkit.js

Đỗ Xuân Hùng doxhung

:octocat:
Working on Appkit.js
View GitHub Profile
@doxhung
doxhung / two-way-binding.js
Created September 8, 2020 13:40 — forked from straker/two-way-binding.js
Simple and small two-way data binding between DOM and data
/**
* @param {object} scope - Object that all bound data will be attached to.
*/
function twoWayBind(scope) {
// a list of all bindings used in the DOM
// @example
// { 'person.name': [<input type="text" data-bind="person.name"/>] }
var bindings = {};
// each bindings old value to be compared for changes
@doxhung
doxhung / scale-canvas.js
Created February 7, 2023 17:20 — forked from callumlocke/scale-canvas.ts
Function to fix a canvas so it will look good on retina/hi-DPI screens.
/**
* This function takes a canvas, context, width and height. It scales both the
* canvas and the context in such a way that everything you draw will be as
* sharp as possible for the device.
*
* It doesn't return anything, it just modifies whatever canvas and context you
* pass in.
*
* Adapted from Paul Lewis's code here:
* http://www.html5rocks.com/en/tutorials/canvas/hidpi/
@doxhung
doxhung / dabblet.css
Last active February 29, 2024 18:49
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@doxhung
doxhung / dabblet.css
Created February 29, 2024 17:32
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;