Skip to content

Instantly share code, notes, and snippets.

View ejosess's full-sized avatar
💤
I may be slow to respond.

ejose ejosess

💤
I may be slow to respond.
View GitHub Profile
@ejosess
ejosess / .gitignore
Last active April 5, 2017 14:52
Useful policies of .gitignore
# Just add any subfolder in uploads path with a .gitkeep file in it to
# ignore all the files except the directory
# this doesnt work
public_html/uploads/**/*
!/**/.gitkeep
# instead, name it every directory that needs to ignore files
public_html/uploads/moduleSuperCool/*
@ejosess
ejosess / file-ajax-download.md
Last active June 20, 2017 13:40
Downlaod a file without opening a new window/popup

HTML

<iframe name="downloadIframe" id="downloadIframe" style="display: none"></iframe>

JAVASCRIPT

downloadTriggered() {
          uri = '/api/v1/users?id=1',
 downloadLink = document.createElement('a');
@ejosess
ejosess / two-daterangepicker-dates.md
Last active February 22, 2017 12:53
Two date inputs synchronized

Two date inputs using daterangepicker and jQuery. If the first date gets an update, the second date will also suffer an update if the range of the first date is higher than the second one.

example

// this.dateRangePicker('#start_at_datepicker', '#start_at_form');
// this.dateRangePicker('#end_at_datepicker', '#end_at_form', true);

dateRangePicker(datepickerInputId, dateInputId, minDate = false) {
    let input = document.querySelector(dateInputId);
@ejosess
ejosess / mysqldump-ignoring-multiple-tables.sh
Last active July 17, 2017 13:49
mysqldump-ignoring-multiple-tables
#!/bin/bash
DB_HOST=""
DB_DATABASE=""
DB_USERNAME=""
DB_PASSWORD=""
read -r -d '' tableSizesQuery << EOF
SELECT
table_schema as 'Database',