Skip to content

Instantly share code, notes, and snippets.

View kimtrien's full-sized avatar

Nguyen Kim Trien kimtrien

View GitHub Profile
@kimtrien
kimtrien / opcache.ini
Created March 18, 2020 16:20 — forked from rohankhudedev/opcache.ini
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@kimtrien
kimtrien / webhook.php
Created February 24, 2020 14:52
Satis webhook
<?php
// Initiate Symfony
require_once __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Process\Process;
// Basic-Configuration
$config = [
'bin' => 'bin/satis',
'json' => 'satis.json',
@kimtrien
kimtrien / laravel remove index.php from url.md
Created January 1, 2020 13:22 — forked from slow-is-fast/laravel remove index.php from url.md
[nginx] laravel remove index.php from url
# Remove index.php$
if ($request_uri ~* "^(.*/)index\.php$") {
    return 301 $1;
}

location / {
    try_files $uri $uri/ /index.php?$query_string;

    # Remove from everywhere index.php

if ($request_uri ~* "^(./)index.php(/?)(.)") {

@kimtrien
kimtrien / limit-pagination.html
Created October 30, 2018 09:37
Limit amount of links shown with Laravel pagination
<script>
(function($) {
$('ul.pagination li.active')
.prev().addClass('show-mobile')
.prev().addClass('show-mobile');
$('ul.pagination li.active')
.next().addClass('show-mobile')
.next().addClass('show-mobile');
$('ul.pagination')
.find('li:first-child, li:last-child, li.active')
@kimtrien
kimtrien / alo-phone.html
Created October 29, 2018 10:25
alo phone css
<div class="ncore-alo-phone">
<div class="ncore-alo-ph-circle"></div>
<div class="ncore-alo-ph-circle-fill"></div>
<div class="ncore-alo-ph-img-circle delaiso"></div>
</div>
<style>
.ncore-alo-phone {
position: fixed;
/*visibility: hidden;*/
@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;
}
@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 / 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 = [
' ',
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 / 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');