Skip to content

Instantly share code, notes, and snippets.

Dário dmarcelino

View GitHub Profile
@dmarcelino
dmarcelino / bs4_display.js
Last active Mar 9, 2018
Simple util library to show/hide HTML elements using the new BS4 classes d-none/d-*-none and d-block/d-*-block.
View bs4_display.js
(function(window){
'use strict';
// wrapper
function bs4Display() {
var _bs4Display = {};
_bs4Display.DUMMY_PREFIX = 'dummy'
// private methods
View xgettext-loader.js
let child = require("child_process")
let source_map = require("source-map")
let SourceMapConsumer = source_map.SourceMapConsumer
let path = require("path")
var crypto = require('crypto');
module.exports = function(source, sourceMap) {
this.cacheable()
this.async()
var self = this
View fix-wordpress-permissions.sh
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@dmarcelino
dmarcelino / compact_timezone_list.html
Last active Feb 10, 2017
Python script to generate compact list of timezones (HTML and json)
View compact_timezone_list.html
<select>
<option utc_offset="-11:00" dst="0" value="Etc/GMT+11">UTC-11:00 Pago Pago, Niue</option>
<option utc_offset="-10:00" dst="0" value="Etc/GMT+10">UTC-10:00 HST, Rarotonga, Tahiti, Honolulu</option>
<option utc_offset="-10:00" dst="1" value="America/Adak">UTC-10:00 Adak</option>
<option utc_offset="-09:30" dst="0" value="Pacific/Marquesas">UTC-09:30 Marquesas</option>
<option utc_offset="-09:00" dst="1" value="America/Anchorage">UTC-09:00 Anchorage, Juneau, Metlakatla, Nome, Sitka, Yakutat</option>
<option utc_offset="-09:00" dst="0" value="Etc/GMT+9">UTC-09:00 Gambier</option>
<option utc_offset="-08:00" dst="0" value="Etc/GMT+8">UTC-08:00 Pitcairn</option>
<option utc_offset="-08:00" dst="1" value="PST8PDT">UTC-08:00 PST8PDT, Dawson, Vancouver, Whitehorse, Tijuana, Los Angeles</option>
<option utc_offset="-07:00" dst="1" value="MST7MDT">UTC-07:00 MST7MDT, Cambridge Bay, Edmonton, Inuvik, Yellowknife, Chihuahua, Mazatlan, Ojinaga, Boise, Denver</option>
View gist:18c7877bbc4db5f1794b571136946b90
Sometimes after a hard reboot (power cut), if your synology cannot be logged in with DSM and it shows "System is getting ready. Please log in later" , please do these steps :
#Admin login via ssh
> synobootseq --set-boot-done
> synobootseq --is-ready
#optional
> /usr/syno/etc/rc.d/S97apache-sys.sh start
> /usr/syno/etc/rc.d/S95sshd.sh start
@dmarcelino
dmarcelino / True Trello Printer
Created Sep 22, 2016 — forked from mathiasrw/True Trello Printer
Ever wanted to print your Trello board? Export as JSON and paste it into the code.
View True Trello Printer
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>True Trello Printer</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<style>
body{margin:15%;}
.panel-body{
@dmarcelino
dmarcelino / search_backends.py
Created Aug 6, 2016 — forked from gregplaysguitar/folding_whoosh_backend.py
Django-haystack Whoosh backend with character folding
View search_backends.py
# -*- coding: utf-8 -*-
"""
Whoosh backend for haystack that implements character folding, as per
http://packages.python.org/Whoosh/stemming.html#character-folding .
Tested with Haystack 2.4.0 and Whooch 2.7.0
To use, put this file on your path and add it to your haystack settings, eg.
@dmarcelino
dmarcelino / .htaccess
Created Feb 8, 2016 — forked from Zodiac1978/.htaccess
Make WordPress faster - a safe htaccess way
View .htaccess
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
#
@dmarcelino
dmarcelino / matchRecordIDs.js
Created Jun 3, 2015
Comparing strategies to match RecordID
View matchRecordIDs.js
var assert = require('assert');
var RecordId = require('oriento').RID;
var _ = require('lodash');
var N = 4000;
function matchRecordIdOriginal(id) {
if (id === null || id == undefined) return false;
var test = _.cloneDeep(id);
if(typeof test.toString !== 'undefined')
@dmarcelino
dmarcelino / npm-debug.log
Created Jun 2, 2015
npm ERR! registry error parsing json
View npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@2.11.0
3 info using node@v0.10.36
4 verbose publish [ '.' ]
5 silly cache add args [ '.', null ]
6 verbose cache add spec .
7 silly cache add parsed spec { raw: '.',
7 silly cache add scope: null,
7 silly cache add name: null,
You can’t perform that action at this time.