Skip to content

Instantly share code, notes, and snippets.

View benjaminW78's full-sized avatar

oh_meeen benjaminW78

View GitHub Profile
@benjaminW78
benjaminW78 / mysql-docker.sh
Created May 6, 2019 10:33 — 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
const batchOfWhatUWant = (items, batchLength = 5000) => {
const allItems = items
const batchCount = allItems.length / batchLength
return Array(Math.ceil(batchCount))
.fill(0)
.map((element, index) => index * batchLength)
.map(start => allItems.slice(start, start + batchLength))
}
@benjaminW78
benjaminW78 / gist:67733c4ebe0f0d2acf5a364d0b43b93d
Created May 4, 2018 07:23
aws elastic beanstalk variable env extract to string
const acc=[]
tableRoot = document.querySelector('table.properties-table')
.querySelectorAll('tbody>tr.ng-scope:not(.ng-hide)>td>input[type="text"]')
.forEach(( current,index) => {
if (index % 2 === 0) {
acc.push({})
acc[acc.length - 1].name = current.value
} else {
acc[acc.length - 1].value = current.value
}
.directive('myDirective', [function () {
return {
restrict : 'E',
replace : true,
controller: 'MyController',
templateUrl : 'directives/myDirective.tpl.html',
link : function (scope, elem, attrs, controller) {
scope.message = 'Hello World!';
controller.toto();
}