Skip to content

Instantly share code, notes, and snippets.

View zelic91's full-sized avatar
💭
It's always good to write down something

Thuong Nguyen zelic91

💭
It's always good to write down something
  • Restaff
  • Vietnam
View GitHub Profile
@zelic91
zelic91 / gist:2741e1b1cfa5664372b2
Last active August 29, 2015 14:23
Android Testing Framework
// JUnit & Mockito
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
// Espresso
androidTestCompile('com.android.support.test.espresso:espresso-core:2.0')
androidTestCompile('com.android.support.test:testing-support-lib:0.1')
androidTestCompile('com.jayway.android.robotium:robotium-solo:5.2.1')
testCompile 'org.hamcrest:hamcrest-core:1.1'
@zelic91
zelic91 / chat-frontend.js
Created March 13, 2018 08:56 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@zelic91
zelic91 / FadeScrollView.swift
Created November 15, 2018 02:45 — forked from luismachado/FadeScrollView.swift
Custom UIScrollView with fade effect
//
// FadeScrollView.swift
//
// Created by Luís Machado on 23/06/2017.
// Copyright © 2017 Luis Machado. All rights reserved.
//
import UIKit
class FadeScrollView: UIScrollView, UIScrollViewDelegate {
info face="Arial-BoldMT" size=37 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2
common lineHeight=42 base=35 scaleW=128 scaleH=64 pages=1 packed=0
page id=0 file="bitmap-font-sample-1.png"
chars count=11
char id=32 x=103 y=33 width=0 height=0 xoffset=0 yoffset=34 xadvance=10 page=0 chnl=0 letter="space"
char id=48 x=86 y=2 width=19 height=29 xoffset=2 yoffset=5 xadvance=21 page=0 chnl=0 letter="0"
char id=49 x=88 y=33 width=13 height=28 xoffset=3 yoffset=6 xadvance=21 page=0 chnl=0 letter="1"
char id=50 x=46 y=33 width=19 height=28 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="2"
char id=51 x=23 y=2 width=19 height=29 xoffset=1 yoffset=5 xadvance=21 page=0 chnl=0 letter="3"
char id=52 x=2 y=33 width=21 height=28 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="4"
@zelic91
zelic91 / install_ssl.txt
Created June 19, 2020 08:09 — forked from emprit1988/install_ssl.txt
Install Entrust SSL in NGINX Server running in Ubuntu 14.04
Step 1: Create chained certificate with the provided crt files. Ordering is important.
~$ cat Server.crt Intermediate.crt Root.crt > Chained_certificate.crt
Step 2: Format the concatenation
The crt file should Follow the syntax
-----Start Certificate-----
############################
############################
-----End Certificate-----
@zelic91
zelic91 / IconView.kt
Created May 12, 2021 10:10 — forked from nickbutcher/IconView.kt
A prototype implementation of a shadow effect inspired by the Google Play Games app (https://play.google.com/store/apps/details?id=com.google.android.play.games).
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@zelic91
zelic91 / index.js
Created May 30, 2021 07:11
Lambda Function for Slack Notification
var https = require('https');
var util = require('util');
exports.handler = (event, context) => {
const message = JSON.parse(event.Records[0].Sns.Message);
console.log(JSON.stringify(event, null, 2));
console.log('Data From SNS: ', message);
const postData = {
@zelic91
zelic91 / base-exec.rb
Created June 2, 2021 02:59
Ruby standalone daemon base app
class BaseExec
def initialize()
@prefix = self.class.name.underscore
@pid_file = Rails.root.join("pids/#{@prefix}.pid")
@log_file = Rails.root.join("logs/#{@prefix}.log")
end
def run!
@zelic91
zelic91 / sample-exec.rb
Created June 2, 2021 10:06
Sample ruby executable
require_relative 'base_exec'
class SampleExec < BaseExec
def initialize()
super()
end
def run!
super
@zelic91
zelic91 / sample.conf
Created June 3, 2021 06:14
Log rotate template
/home/<some directories>/log/*.log {
daily
rotate 7
size 10M
compress
delaycompress
}