Skip to content

Instantly share code, notes, and snippets.

@danielepiccone
danielepiccone / htaccess
Created November 10, 2012 19:05
htaccess
<IfModule mod_rewrite.c>
#RewriteBase relative to .htaccess path
RewriteEngine On
RewriteBase /APP_FOLDER
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
<?php
function limit_words($string, $word_limit)
{
$words = explode(" ",$string);
@danielepiccone
danielepiccone / virtualbox_servers_start_stop
Created June 28, 2013 10:13
Start and stop local virtualbox server from the command line
REM $VM is the name of the virtual machine as set in virtualbox
VBoxManage.exe startvm $VM --type headless
VBoxManage.exe controlvm $VM savestate
@danielepiccone
danielepiccone / terminal.bat
Last active December 19, 2015 10:19
Cygwin compatible command shell for Windows, it runs almost all Cygwin packages with color support, use it if you need the Cygwin utilities but still use batch scripts
@echo off
set TERM=cygwin
doskey ls = ls --color
cmd

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English

@danielepiccone
danielepiccone / list browser events
Created August 21, 2013 08:28
list browser events
var i = '', out = [];
for (i in window) {
if ( /^on/.test(i)) { out[out.length] = i; }
}
console.log( out.join(', ') );
@danielepiccone
danielepiccone / onchange.sh
Last active December 26, 2015 16:29 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@danielepiccone
danielepiccone / gist:7656716
Created November 26, 2013 11:12
Symlink fix for Win7/Virtualbox
VBoxManage setextradata Developement VBoxInternal2/SharedFoldersEnableSymlinksCreate/Dev 1
VBoxManage setextradata Developement VBoxInternal2/SharedFoldersEnableSymlinksCreate/htdocs 1
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"