Skip to content

Instantly share code, notes, and snippets.

View channainfo's full-sized avatar
🎯
Focusing

Channa Ly channainfo

🎯
Focusing
  • InSTEDD, SureSwift Capital, BookMeBus, VTENH, Onthegosystems
  • Phnom Penh
  • X @channaly
  • LinkedIn in/channaly
View GitHub Profile
@channainfo
channainfo / .gitconfig
Created September 30, 2015 02:21 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@channainfo
channainfo / smart_luys_payment_keypairs_tester.php
Created February 1, 2016 09:33
Smart luy payment gateway
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$public_key_file = "book_me_bus_public.key" ;
$private_key_file = "book_me_bus_private.key" ;
function better_echo($var, $title = "") {
if($title)
@channainfo
channainfo / active_record_model.php
Last active October 13, 2016 05:53
Active record model mapper in Codeignite CI2
<?php
class ActiveRecordModel extends CI_Model {
protected $_errors = array();
protected $_changes = array();
protected $_not_sql_fields = array('_errors', '_changes', '_not_sql_fields');
// define your table primary key name here
static function primary_key() {
return 'id';
}
@channainfo
channainfo / modify_query_string.js
Created August 10, 2018 03:02
Add or modify current url query string with new values in JQuery javascript
// Luckily Jquery not required.
function ModifyQueryString(url, newKey, newValue){
var params = {}
var urlSplits = url.split("?");
var baseURL = urlSplits[0]
var queryString = urlSplits[1]
if(!queryString) {
params[newKey] = newValue
@channainfo
channainfo / install_ffmpeg_ubuntu.sh
Created March 27, 2019 07:33 — forked from dalmatele/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04, 16.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@channainfo
channainfo / webpack.config.js
Created April 30, 2019 11:20
Multiple js and css file with web pack in Phoenix 1.4
// regenerate wit mix phx.server
// target location priv/statics/(js|css)
// sometime does not work well I think because of caching
// might need to play around with key names in the entry objects to see if it takes affect.
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
@channainfo
channainfo / webpack.config.js
Created April 30, 2019 11:20
Multiple js and css file with web pack in Phoenix 1.4
// regenerate wit mix phx.server
// target location priv/statics/(js|css)
// sometime does not work well I think because of caching
// might need to play around with key names in the entry objects to see if it takes affect.
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
@channainfo
channainfo / webpack.config.js
Created April 30, 2019 11:20
Multiple js and css file with web pack in Phoenix 1.4
// regenerate wit mix phx.server
// target location priv/statics/(js|css)
// sometime does not work well I think because of caching
// might need to play around with key names in the entry objects to see if it takes affect.
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
@channainfo
channainfo / webpack.config.js
Last active May 2, 2019 01:52
multiple entries js, css in phoenix framework webpack
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => ({
optimization: {
minimizer: [
@channainfo
channainfo / webpack.config.js
Created May 4, 2019 17:03
Multiple entries from a directory dynamically
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const templateEntries = glob.sync('./js/templates/**.js').reduce(function(obj, el){
var name = "./templates/" + path.parse(el).name
obj[name] = el;