Skip to content

Instantly share code, notes, and snippets.

View koffisani's full-sized avatar

Koffi SANI koffisani

View GitHub Profile
@koffisani
koffisani / gist:43350052e8f04994eb0eb76286f96220
Last active May 8, 2020 09:46 — forked from jasoet/gist:3843797
Database Connection Singleton
View gist:43350052e8f04994eb0eb76286f96220
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.secondstack.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@koffisani
koffisani / .gitlab-ci.yml
Created February 21, 2020 08:04
Gitlab CI config for wordpress theme
View .gitlab-ci.yml
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wordpress_tests
MYSQL_ROOT_PASSWORD: mysql
before_script:
# Install dependencies
# update the docker
- apt-get clean
@koffisani
koffisani / request-geocoding.py
Last active May 8, 2019 18:00
Request Geocoding Open Street Map Nomatim
View request-geocoding.py
import requests
url = 'https://nominatim.openstreetmap.org/reverse'
## Sample data
lon_value=1.19116
lat_value=6.2169
params = dict(
format='jsonv2',
lat=lat_value,
@koffisani
koffisani / .gitlab-ci.yml
Created March 28, 2019 08:41
Gitlab CI config for GeoDjango
View .gitlab-ci.yml
image: python:latest
services:
- postgres:latest
variables:
POSTGRES_DB: ci
cache:
paths:
View Install Android emulator on Ubuntu and run the Ionic app on mobile
1. install openjdk
`sudo apt-get install openjdk-7-jdk`
2. install `android sdk`
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
@koffisani
koffisani / mysql_countries.sql
Created January 22, 2018 14:04 — forked from kamermans/mysql_countries.sql
MySQL Dump - continents and countries with 2 and 3 char codes, names and full names - Braintree compatible as of Dec 2011
View mysql_countries.sql
/**
* Continents and Countries MySQL Tables compiled from Wikipedia, Braintree Payments documentation
* and a couple other places I don't recall at the moment. This data is compatible with the Braintree
* Payment API as of Dec 2011
*
* Compiled by Steve Kamerman, 2011
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
@koffisani
koffisani / add-months-to-date.php
Last active May 9, 2017 10:07
Adds months to a date without skipping february
View add-months-to-date.php
<?php
/* As inspired by http://stackoverflow.com/a/10734891/3156582 */
$date = '2017-01-31';
$nbremois = -13;
$d1 = DateTime::createFromFormat('Y-m-d', $date);
$year = $d1->format('Y');
$month = $d1->format('m');
$day = $d1->format('d');
@koffisani
koffisani / code-author-latex.tex
Created April 20, 2017 09:17
Code author in LaTeX
View code-author-latex.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%---DIAPO AVEC LATEX----%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% @author Koffi Sani : <koffisani@gmail.com>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@koffisani
koffisani / usefull-alias.md
Last active February 5, 2020 09:53
Usefull Git Alias
View usefull-alias.md
git config --global alias.logg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"

OR

git config --global alias.loggg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
@koffisani
koffisani / get-content-from-meta-tags-in-js.js
Created February 1, 2017 08:25
Get data from meta tags in javascript
View get-content-from-meta-tags-in-js.js
<script type='text/javascript'>
/*
* Here we try to retreive a data from <meta name="bitly:url" content=""/>
*/
var BitlyURL = jQuery('meta[property="bitly:url"]').attr('content');
var url = "";
if ( typeof BitlyURL !== 'undefined' ){
url = BitlyURL;
}