Skip to content

Instantly share code, notes, and snippets.

View Hp93's full-sized avatar

Hùng Hp93

  • Vietnam
View GitHub Profile
@Hp93
Hp93 / tikiUtils.js
Last active January 31, 2022 09:01
// ==UserScript==
// @name tiki utilities
// @version 1
// @grant none
// ==/UserScript==
function remove()
{
window.setTimeout(function() {
var productContainer = document.querySelectorAll("[data-view-id='product_list_container']");
@Hp93
Hp93 / index.html
Created March 17, 2021 08:01
Query builder
<div class="RuleDefinition">
<select class="rule-selector template" data-oldval="">
<option value="">Select</option>
<option value="if">If</option>
<option value="operation">Operation</option>
<option value="value">Value</option>
</select>
<select class="condition-operator-selector template" data-oldval="">
<option value="equals">equals</option>
<option value="greaterthan">greater than</option>
@Hp93
Hp93 / Logger
Created September 10, 2019 17:02
Logger.cs
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading;
namespace ConsoleApp
{
public class Logger
{
private static Lazy<ConcurrentQueue<string>> _outputLog = new Lazy<ConcurrentQueue<string>>();
@Hp93
Hp93 / SecureRandomGenerator.cs
Created June 14, 2019 03:23
SecureRandomGenerator
public class SecureRandomGenerator
{
readonly RNGCryptoServiceProvider csp;
public SecureRandomGenerator()
{
csp = new RNGCryptoServiceProvider();
}
public int Next(int maxExclusiveValue)
// Node modules
var fs = require('fs'),
durandalBundler = require('./durandal-bundler'),
gulp = require('gulp'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css'),
runSequence = require('run-sequence');
var outputFolder = './dev/dist',
destinationFolder = '../v1/dist';
@Hp93
Hp93 / durandal-bundler.js
Last active March 13, 2019 12:14
durandal-bundler.js
var _fs = require('fs'),
_path = require('path'),
_es = require('event-stream'),
_glob = require('glob'),
_ = require('lodash')._,
_gutil = require('gulp-util'),
_rjs = require('gulp-requirejs'),
_merge = require('deeply'),
_Q = require('q'),
_esprima = require('esprima'),
function isPublicHoliday(date) {
if (!(date instanceof Date)) {
return false;
}
var dayInWeek = {
"Sunday": 0,
"Monday": 1,
"Tuesday": 2,
"Wednesday": 3,
@Hp93
Hp93 / RandomColor
Last active August 29, 2015 14:24
Generate random color base on string input
private KnownColor[] AllColors
{
get
{
if (_allColors != null)
{
return _allColors;
}
// Get all the values from the KnownColor enumeration.
@Hp93
Hp93 / WatchObjectChange
Created April 20, 2015 08:44
Enable object.prototype.watch for non-supported browsers
if (!Object.prototype.watch) {
Object.defineProperty(Object.prototype, "watch", {
enumerable: false,
configurable: true,
writable: false,
value: function (prop, handler) {
var oldval = this[prop],
newval = oldval,
getter = function () {
return newval;
DECLARE @RowCount int
DECLARE @Random int
SET @RowCount = 0
WHILE @RowCount < 100
BEGIN
SELECT @Random = ROUND((10 * RAND()), 0)
INSERT INTO dbo.Sample_Table (column_1, column_2)