Skip to content

Instantly share code, notes, and snippets.

View kimtrien's full-sized avatar

Nguyen Kim Trien kimtrien

View GitHub Profile
@kimtrien
kimtrien / num_forvietnamese.php
Last active June 13, 2017 02:59
Number for vietnamese PHP
<?php
function num_forvietnamese($num = false)
{
$str = '';
$num = trim($num);
$f = number_format($num);
$arr = str_split($f);
@kimtrien
kimtrien / justify-menu.css
Created June 15, 2017 04:05
justify a horizontal menu
ul{
display: flex;
justify-content: space-between;
}
@kimtrien
kimtrien / tricks.css
Last active August 5, 2017 02:23
Tricks CSS
.text-overflow{
display: block;
display: -webkit-box;
-webkit-line-clamp: 2; // Line number
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.list-column-wrapping {
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
@kimtrien
kimtrien / fixed-scroll-up.html
Created July 22, 2017 04:30
Event scroll up and fixed header jquery
<header>
Header
</header>
<script>
$(document).ready(function () {
var lastScroll = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
// Make sure they scroll more than delta
@kimtrien
kimtrien / fix_on_scroll.html
Created July 22, 2017 04:37
Fix a header on scroll
<section>
<div class="sticky">This div will stick to the top</div>
</section>
<script>
$(window).scroll(function(){
var sticky = $('.sticky'),
scroll = $(window).scrollTop();
if (scroll >= 100) sticky.addClass('fixed');
public static List<String> findNotMatching(String sourceStr, String anotherStr){
String new_souce = sourceStr.replaceAll("[^a-zA-Z ]", "").toLowerCase();
anotherStr = anotherStr.replaceAll("[^a-zA-Z ]", "").toLowerCase();
StringTokenizer at = new StringTokenizer(new_souce, " ");
StringTokenizer bt = null;
int i = 0, token_count = 0;
String token = null;
boolean flag = false;
List<String> missingWords = new ArrayList<String>();
@kimtrien
kimtrien / str_slug.js
Created June 15, 2018 12:03 — forked from lvthinh1487/str_slug.js
str_slug js fuction export from laravel framework
function trim(str, charlist) {
// example 1: trim(' Kevin van Zonneveld ')
// returns 1: 'Kevin van Zonneveld'
// example 2: trim('Hello World', 'Hdle')
// returns 2: 'o Wor'
// example 3: trim(16, 1)
// returns 3: '6'
let whitespace = [
' ',
@kimtrien
kimtrien / unzip.php
Created June 24, 2018 02:06 — forked from trajche/unzip.php
Unzip a file on one.com with PHP
<?php
$unzip = new ZipArchive;
$out = $unzip->open('file-name.zip');
if ($out === TRUE) {
$unzip->extractTo(getcwd());
$unzip->close();
echo 'File unzipped';
} else {
echo 'Something went wrong?';
@kimtrien
kimtrien / text-overflow.css
Created September 27, 2018 04:18
Text overflow two line
.text-overflow{
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}