Skip to content

Instantly share code, notes, and snippets.

View manhnguyenv's full-sized avatar

Manh Nguyen manhnguyenv

View GitHub Profile
@manhnguyenv
manhnguyenv / ElasticSearch+Redis
Last active September 19, 2019 11:30
ElasticSearch+Redis
ElasticSearch stores data in indexes and supports powerful searching capabilities
Redis has speed and powerful data structures. It can almost function as an extension of application memory but shared across processes / servers.
@manhnguyenv
manhnguyenv / StringInJavaScript.html
Last active August 8, 2019 03:37
Learn String JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
console.log(stringContainString(["Alien", "line"])); // true
console.log(stringContainString(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])); // true
console.log(stringContainString(["Hello", "hey"])); // false
@manhnguyenv
manhnguyenv / DataTableResultSet.cs
Created August 7, 2019 10:56 — forked from OllieJones/DataTableResultSet.cs
C# code for handling Ajax calls for the DataTables.net client table-rendering plugin.
/// <summary>
/// Resultset to be JSON stringified and set back to client.
/// </summary>
[Serializable]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class DataTableResultSet
{
/// <summary>Array of records. Each element of the array is itself an array of columns</summary>
public List<List<string>> data = new List<List<string>>();
public class BloggingContext : DbContext
{
public DbSet<Blog> Blogs { get; set; }
public DbSet<Post> Posts { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
optionsBuilder
//Log parameter values
.EnableSensitiveDataLogging()
.UseSqlCe(@"Data Source=Blogging.sdf");
@manhnguyenv
manhnguyenv / modal-jq-bootstrap
Created August 1, 2019 02:39 — forked from marc-gist/modal-jq-bootstrap
bootstrap modal with jquery show button
<script>
/* to show modal via jquery clock event bound to id="modal_button_id" a/button/etc */
$(document).ready(function() {
$('#modal_button_id').click(function (event) {
$('#myModal').modal('show')
});
</script>
<div class="modal hide fade" id="modalID">
<div class="modal-header">
https://medium.com/@jcbaey/authentication-in-spa-reactjs-and-vuejs-the-right-way-e4a9ac5cd9a3
@manhnguyenv
manhnguyenv / code-block.html
Created July 19, 2019 07:01 — forked from mathewbyrne/code-block.html
A fun little experiment playing with CSS box shadows. I think it roughly works in Safari, Chrome and Firefox. No guarantees though.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Shadows Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style>
* {
@manhnguyenv
manhnguyenv / location.html
Created July 19, 2019 07:00 — forked from mathewbyrne/location.html
A small, single-page tool for getting your current geolocation.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Navigation Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script>
var isTouchDevice = 'ontouchstart' in document.documentElement;
window.onload = function () {
var where = document.getElementById('where');
@manhnguyenv
manhnguyenv / toSlug.js
Created July 19, 2019 06:58
JavaScript toSlug.js
String.prototype.toSlug = function(){
st = this.toLowerCase();
st = st.replace(/[\u00C0-\u00C5]/ig,'a')
st = st.replace(/[\u00C8-\u00CB]/ig,'e')
st = st.replace(/[\u00CC-\u00CF]/ig,'i')
st = st.replace(/[\u00D2-\u00D6]/ig,'o')
st = st.replace(/[\u00D9-\u00DC]/ig,'u')
st = st.replace(/[\u00D1]/ig,'n')
st = st.replace(/[^a-z0-9 ]+/gi,'')
st = st.trim().replace(/ /g,'-');
@manhnguyenv
manhnguyenv / Slug.html
Created July 19, 2019 06:57
Generating Slugs with JavaScript (Slug.js)
<!DOCTYPE html>
<html>
<body>
<p>Click the button to return the value of the string object.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>