Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ever Daniel Barreto everdaniel

🏠
Working from home
View GitHub Profile
@everdaniel
everdaniel / dashboard.php
Created Apr 13, 2013
Demo files from a Management Application for the Hospitality Industry
View dashboard.php
<?php
/**
* Dashboard Controller
*
**/
class Dashboard extends Controller
{
/**
* dashboard::dashboard()
@everdaniel
everdaniel / MY_Controller.php
Created Apr 13, 2013
Demo files for a Competition site built for Cisco Saudi Arabia
View MY_Controller.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Base Controller
*
*/
class MY_Controller extends Controller
{
/**
* Auth Library
@everdaniel
everdaniel / GRR_Admin_Controller.php
Last active Dec 16, 2015
Demo files from a competition site built for an Ad Agency
View GRR_Admin_Controller.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Base Admin Controller
*
*/
class GRR_Admin_Controller extends CI_Controller
{
/**
* Assets (JS/CSS) from the Controllers
*
View app.rake
------------ From Rake Task
namespace :app do
# Checks and ensures task is not run in production.
task :ensure_development_environment => :environment do
if Rails.env.production?
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)"
end
end
View itunesicon.rb
#!/usr/bin/ruby
# encoding: utf-8
#
# Retrieve an iOS app icon at the highest available resolution
# All arguments are combined to create an iTunes search
# The icon for the first result, if found, is written to a filename based on search terms
#
# example:
# $ itunesicon super monsters ate my condo
View multio.rb
# MultIO Ruby IO multiplexer
# http://rcrowley.org/2010/07/27/multio-ruby-io-multiplexer.html
require 'stringio'
class MultIO < Array
def <<(io)
if io.respond_to?(:to_str)
io = StringIO.new(io)
@everdaniel
everdaniel / delphi.rb
Created May 6, 2013
Generate a CSV file with all projects listed at Embarcadero App Showcase
View delphi.rb
require "mechanize"
require "csv"
agent = Mechanize.new
page = agent.get("http://www.embarcadero.com/index.php?option=com_mmportfolio&view=projects&layout=appshowcase&format=raw")
projects = []
page.search("div.appitem").each do |item|
puts "Fetching: " + item.text
id = item["rel"]
name = item.text
@everdaniel
everdaniel / gist:5943969
Created Jul 7, 2013
JS Config Object in Header / CodeIgniter
View gist:5943969
<script type="text/javascript">
/* <![CDATA[ */
// Global My App Namespace
window.myapp = window.myapp || {};
// AJAX Namespace
myapp.ajax = myapp.ajax || {};
myapp.ajax.csrf = '98dd0f785e';
myapp.ajax.paths = {
View move_to_rds.rb
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
View baseline.php
<?php
//Pull historical daily; assumes that historical has at least as many years as the generated.
$sql = "select * from verde_historical_daily where year <= :year";
$core = Core::getInstance();
$stmt = $core->dbh->prepare($sql);
$stmt->bindParam(':year', $totalYears, PDO::PARAM_INT);
try {
$stmt->execute()