Skip to content

Instantly share code, notes, and snippets.

@xedef
xedef / mysql-date-dimension.sql
Created April 22, 2019 22:39
Generate date dimension table in MySQL
-- Based on John Grimes gist: https://gist.github.com/johngrimes/408559
-- Choose the date range to generate by changing dates in WHERE clause at line 41
DROP TABLE IF EXISTS d_date;
CREATE TABLE d_date (
id BIGINT PRIMARY KEY,
`date` DATE NOT NULL,
`timestamp` BIGINT NOT NULL,
day_name CHAR(10) NOT NULL,
is_weekday BOOL NOT NULL,
@xedef
xedef / remove-indexing-files.md
Last active November 4, 2020 21:03
Remove all .DS_Store files (or any unwanted indexing file) from a S3 bucket, recursively

You can replace "*.DS_Store" with any other recurrent file (e.g. Desktop.ini)

Please!

Validate that you are going to delete only what you want passing the --dryrun option. I've left if by default just in case of copy/paste.

aws s3 rm s3://your.bucket.name/maybe-a-subkey --dryrun --recursive --exclude "*" --include "*.DS_Store"

@xedef
xedef / CategorySagas.js
Created July 12, 2017 03:48 — forked from pesakitan22/CategorySagas.js
Redux-Saga for next.js
import {call, put, take, fork} from 'redux-saga/effects'
import {END} from 'redux-saga'
import CategoryActions, {CategoryTypes} from '../Redux/CategoryRedux'
// attempts to fetch category
export function* fetchCategoryServer (api) {
let action = yield take(CategoryTypes.CATEGORY_SERVER)
// check when it stopped
while (action !== END) {
yield fork(fetchCategoryAPI, api)
@xedef
xedef / url-builder.js
Last active September 5, 2016 03:21
Intelligently buils an URL from the arguments.
/**
* NOTE: Requires Underscore >=1.4.3
*
* Intelligently buils an URL from the arguments.
* . If the parameter is a string or a number, is part or the URL (in the order passed)
* . If the parameter is an object, is taken as a query param.
*
* Examples:
* urlBuilder('http://google.com')
* 'http://google.com'
@xedef
xedef / ios-device-ids.js
Created April 29, 2015 05:39
Generate iOS Simulators IDs for a given iOS version
/**
* Usage:
* node ios-device-ids.js <ios_version>
*/
var ioslib = require('ioslib'),
_ = require('underscore'),
args = process.argv.slice(2);
if (args && args[0])