Skip to content

Instantly share code, notes, and snippets.

View kafkadev's full-sized avatar
🏠
Working from home

Gokhan Celik kafkadev

🏠
Working from home
View GitHub Profile
@kafkadev
kafkadev / idea-1.md
Created August 1, 2018 13:20 — forked from sveneisenschmidt/idea-1.md
[Draft] Parallel execution of CodeceptJS tasks

Idea 1

Introduce chunking to run-multiple

A first step is to introduce file base chunking to run-multiple. Technically we will do
a dynamic expansion of configuration to generate (n) run groups base one the chunks configured.

Context Files:

  • codecept.json
  • features/example1_test.js
@kafkadev
kafkadev / install
Created August 1, 2018 13:11 — forked from ruslyrossi47/install
Install Codeception, Selenium, Chromedriver, Google Chrome and Xvfb in Debian/Ubuntu
Download Composer
root@do:/var/www/codecept$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
root@do:/var/www/codecept$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
root@do:/var/www/codecept$ php composer-setup.php
root@do:/var/www/codecept$ php -r "unlink('composer-setup.php');"
Install & configure codecept
# Download codecept and install using composer
root@do:/var/www/codecept$ php composer.phar require "codeception/codeception" --dev
@kafkadev
kafkadev / mysql-docker.sh
Created July 7, 2018 21:44 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@kafkadev
kafkadev / img_resize.js
Created June 23, 2018 18:53 — forked from makevoid/img_resize.js
Resize Images with Canvas on the clientside
var settings = {
max_width: 600,
max_height: 200
}
resize_image = function(img){
var ctx = canvas.getContext("2d")
var canvasCopy = document.createElement("canvas")
var copyContext = canvasCopy.getContext("2d")
@kafkadev
kafkadev / paramMap.service.ts
Created June 8, 2018 02:55 — forked from m-spyratos/paramMap.service.ts
Service to get all the application's route parameters, as a ParamMap.
import {Injectable} from '@angular/core';
import {
ActivatedRoute,
Router,
NavigationEnd,
ParamMap,
PRIMARY_OUTLET,
RouterEvent
} from '@angular/router';
import {Observable} from 'rxjs/Observable';
@kafkadev
kafkadev / LaravelQueryJoinRelations.php
Created June 4, 2018 05:24 — forked from MatteoOreficeIT/LaravelQueryJoinRelations.php
Laravel Query Join through Relations
<?php
/**
* User: matteo.orefice
* Date: 16/02/2018
* Time: 16:57
*/
namespace MatteoOrefice\Illuminate\Database\Eloquent\Concerns;
@kafkadev
kafkadev / Excel.php
Created June 2, 2018 22:23 — forked from ihumanable/Excel.php
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {
@kafkadev
kafkadev / enable.rb
Created June 1, 2018 16:45 — forked from melnikaite/enable.rb
enable JSON functions in SQLite
# To enable JSON functions in SQLite run in irb
require 'sqlite3'
c = SQLite3::Database.new('database')
c.enable_load_extension(1)
c.load_extension('/usr/local/Cellar/sqlite/3.14.2/lib/libsqlitefunctions.dylib')
@kafkadev
kafkadev / sqlite3-json1
Created June 1, 2018 15:51
sqlite3-json1
SELECT json_object('ex','[52,3.14159]'),
json_array(1,2,'3',4),
json_array_length('[1,2,3,4]'),
json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$'),
json_insert('{"a":2,"c":4}', '$.a', 99),
json_replace('{"a":2,"c":4}', '$.a', 99),
json_object('a',2,'c',json_object('e',5)),
json_remove('[0,1,2,3,4]','$[2]'),
json_type('{"a":[2,3.5,true,false,null,"x"]}'),
json_valid('{"x":35}')