Skip to content

Instantly share code, notes, and snippets.

@fnicastri
fnicastri / .gitignore
Last active August 29, 2015 14:06 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@fnicastri
fnicastri / SSHA512_gen.py
Last active August 29, 2015 14:26 — forked from garrettreid/SSHA512_gen.py
Create a salted SHA512 password hash for use with Dovecot
#!/usr/bin/python
import os
import hashlib
import getpass
import base64
password1 = None
password2 = None
/*
Matt Browne
The function by 1franck to allow comments works except if there is a comment at the very beginning of the file. Here's a modified version (only the regex was changed) that accounts for that.
*/
function json_clean_decode($json, $assoc = false, $depth = 512, $options = 0) {
// search and remove comments like /* */ and //
$json = preg_replace("#(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|([\s\t]//.*)|(^//.*)#", '', $json);
if(version_compare(phpversion(), '5.4.0', '>=')) {
@fnicastri
fnicastri / gist:4d2793cc2b3c85fb8e6bd28d26f0639b
Created June 27, 2016 16:37
WP unregister custom file type
if ( ! function_exists( 'unregister_post_type' ) ) :
function unregister_post_type( $post_type ) {
global $wp_post_types;
if ( isset( $wp_post_types[ $post_type ] ) ) {
unset( $wp_post_types[ $post_type ] );
return true;
}
return false;
}
endif;
@fnicastri
fnicastri / Vagrantfile
Created September 1, 2016 07:21
NodeJS + Express + Ubuntu 14.4 Vagrant env
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "55.55.55.101"
config.vm.synced_folder "shared", "/home/vagrant/shared/"
config.vm.provision "shell", inline: <<-SHELL
@fnicastri
fnicastri / google_domains.json
Created February 6, 2017 18:47
Google search domain names.
{
"google": [
{
"state":"Ascension Island",
"label":"Ascension Island",
"ext":".ac",
"code":"AC",
"domain":"google.ac"
},
{
@fnicastri
fnicastri / README-Template.md
Created February 16, 2017 22:21 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Don't use eval unless you absolutely, positively have no other choice.
As has been mentioned, using something like this would be the best way to do it:
window["functionName"](arguments);
That, however, will not work with a namespace'd function:
@fnicastri
fnicastri / .htaccess-mod_headers
Created February 20, 2017 17:37 — forked from hans2103/.htaccess-mod_headers
.htaccess rules to set cache control.
<IfModule mod_headers.c>
Header set Connection keep-alive
# Cache-control headers
# 2 HOURS
#<filesMatch "*">
Header set Cache-Control "max-age=7200, must-revalidate"
#</filesMatch>
# 480 weeks - 290304000
@fnicastri
fnicastri / createIcons.sh
Created March 5, 2017 13:05 — forked from strobic/createIcons.sh
A Bash Script to Generate All the Required App Icon Sizes for iOS
#!/bin/bash
#This script will automatically generate all correct sized icons for IOS x and Later
#from a single .svg file
#This script requires ImageMagick (macport or brew it or something)
#usage is:
#>./createIcons.sh [source_file_name].svg
echo $1
fullfile=$1