Skip to content

Instantly share code, notes, and snippets.

View ricardodantas's full-sized avatar
👋
hi!

Ricardo Dantas ricardodantas

👋
hi!
View GitHub Profile
@ricardodantas
ricardodantas / dbf2sqlite.sh
Created December 4, 2012 03:49
dbf2sqlite.sh
#!/bin/bash
# DESCRIPTION="Using other scripts, that piece of code imports DBF file into sqlite3 databases.
# It's necesary that the data directory was in the same directory than this script"
# usage() {
# echo -e "\n`basename $0` $sqlitedatabase $data"
# echo
# echo $DESCRIPTION
# echo
@ricardodantas
ricardodantas / dbf2mysql.php
Created December 4, 2012 03:57
dbf2mysql.php
<?php
// sample to use: php dbf2mysql.php > {filename}.sql
$db = false;
if($argc >= 2) {
$table = 'table';
$iconvFrom = '866';
$iconvTo = 'UTF-8';
@ricardodantas
ricardodantas / dbf2mysql_2.php
Created December 4, 2012 04:01
dbf2mysql_2.php
<?php
// Path to dbase file
$db_path = "dbftable.DBF";
// Open dbase file
$dbh = dbase_open($db_path, 0)
or die("Error! Could not open dbase database file '$db_path'.");
// Get column information
$column_info = dbase_get_header_info($dbh);
$nfldcount = count($column_info);
//create the sql table structure f
@ricardodantas
ricardodantas / dbf2mysql.class.php
Created December 4, 2012 04:05
dbf2mysql.class.php
<?php
/**
** Convert DBF files to MySQL file
** contact: http://gschimpf.com/
**
** USAGE:
** $filename = "dir/file.dbf";
** // Show the result sql
** dbf2mysql::mostrarSQL($filename);
@ricardodantas
ricardodantas / Laravel-capistrano-deploy.rb
Last active July 28, 2017 14:02 — forked from purwandi/deploy.rb
Laravel deployment with capistrano
set :application, "App Name" # Your app name
set :repository, "git@github.com:xxxxx/xxx.git" # Your git repository
set :document_root, "/home/user/www/awesome_app"
set :deploy_via, :remote_cache
# SSH Settings
set :user, "user_ssh"
set :password, "password_ssh"
set :use_sudo, false
@ricardodantas
ricardodantas / autoload.php
Created March 6, 2013 16:28
Autoload function with "implements"
function __autoload($classe)
{
$diretorios = array('class', 'interface');
foreach ( $diretorios as $diretorio ) {
if ( file_exists($diretorio . '/' . $classe . '.php') ) {
require $diretorio . '/' . $classe . '.php';
break;
}
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@ricardodantas
ricardodantas / sublime-sync-dropbox.txt
Created March 30, 2013 04:36
Sync Sublime Text 2 with Dropbox
* Quit Sublime Text 2 (so you don’t accidentally change any settings)
* In your Dropbox folder (usually at ~/Dropbox/), add a folder called Sublime Text 2
* Open the folder with your ST2 settings (should be ~/Library/Application Support/Sublime Text 2/)
* Copy the following 3 folders into ~/Dropbox/Sublime Text 2/: Installed Packages, Packages, and Pristine Packages
* Rename the original 3 folders in ~/Library/Application Support/Sublime Text 2/ to something like Installed Packages-20110119,
@ricardodantas
ricardodantas / .htaccess_laravel_public
Created April 19, 2013 13:50
.htaccess to activate laravel 3.x "public" dir
# Apache configuration file
# http://httpd.apache.org/docs/2.2/mod/quickreference.html
# Note: ".htaccess" files are an overhead for each request. This logic should
# be placed in your Apache config whenever possible.
# http://httpd.apache.org/docs/2.2/howto/htaccess.html
# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.
@ricardodantas
ricardodantas / wrap-string.js
Created April 23, 2013 18:28
Javascript wrap string function.
function GetWrapedText(text, maxlength) {
var resultText = [""];
var len = text.length;
if (maxlength >= len) {
return text;
}
else {
var totalStrCount = parseInt(len / maxlength);
if (len % maxlength != 0) {
totalStrCount++