Skip to content

Instantly share code, notes, and snippets.

View huynhsamha's full-sized avatar

Ha huynhsamha

  • Ho Chi Minh, Vietnam
View GitHub Profile
@huynhsamha
huynhsamha / advance_malloc.c
Last active March 8, 2018 12:56
Simple custom malloc() and free() in C use system call sbrk() - manage with linked list
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#define ERROR_ON_SBRK (void *)-1
// Store info about block
@huynhsamha
huynhsamha / aligned_malloc.c
Created March 8, 2018 12:58
aligned malloc() and free() custom with sbrk()
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include "ex1.h"
#define ERROR_ON_SBRK (void *)-1
npm install --save js-convert-case
yarn add js-convert-case
<!-- Download from NPM -->
<script src="./node_modules/js-convert-case/dist/js-convert-case.js"></script>
<!-- Or use minified -->
<script src="./node_modules/js-convert-case/dist/js-convert-case.min.js"></script>
<!-- Download directly -->
<script src="path/to/js-convert-case"></script>
(() => {
console.log(jsConvert.toCamelCase('param-case')); // paramCase
console.log(jsConvert.toSnakeCase('param-case')); // param_case
console.log(jsConvert.toPascalCase('param-case')); // ParamCase
console.log(jsConvert.toDotCase('param-case')); // param.case
console.log(jsConvert.toPathCase('param-case')); // param/case
console.log(jsConvert.toTextCase('param-case')); // param case
console.log(jsConvert.toSentenceCase('param-case')); // Param case
console.log(jsConvert.toHeaderCase('param-case')); // Param Case
console.log(jsConvert.toLowerCase('param-case')); // param-case
git clone https://github.com/huynhsamha/js-convert-case.git
console.log(jsConvert.toCamelCase('param-case')); // paramCase
console.log(jsConvert.toCamelCase('camelCase')); // camelCase
console.log(jsConvert.toCamelCase('Title Case')); // titleCase
console.log(jsConvert.toSnakeCase('param-case')); // param_case
console.log(jsConvert.toSnakeCase('camelCase')); // camel_case
console.log(jsConvert.toSnakeCase('Title Case')); // title_case
console.log(jsConvert.toPascalCase('param-case')); // ParamCase
console.log(jsConvert.toPascalCase('camelCase')); // CamelCase
// Specific values
console.log(jsConvert.toCamelCase('')); // => ''
console.log(jsConvert.toSnakeCase(null)); // => ''
console.log(jsConvert.toPascalCase(undefined)); // => ''
@huynhsamha
huynhsamha / AVLTree.h
Last active April 21, 2018 12:33
AVL Tree (HCMUT)
#pragma once
namespace shama {
enum BalanceFactor { LH = -1, EH = 0, RH = 1 };
template <class T>
struct AVLNode {
T data;
AVLNode* L = nullptr;