Skip to content

Instantly share code, notes, and snippets.

View jpfuentes2's full-sized avatar

Jacques Fuentes jpfuentes2

  • Chime
  • Richmond, VA
View GitHub Profile
<?php
class DateTime extends \DateTime
{
private static $DATE_NAMES = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
private static $FORMATS = array('ymd' => 'Y-m-d', 'jenark' => 'm/d/y', 'mysql' => 'Y-m-d');
private static $DEFAULT_FORMAT = 'ymd';
public function __call($method, $args)
{
if (substr($method, 0, 2) === "is" && in_array(substr($method, 2), self::$DATE_NAMES))
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
@jpfuentes2
jpfuentes2 / gist:1137095
Created August 10, 2011 15:17
scope golf
def self.define_scopes(&block)
class_eval do
missing = method(:method_missing)
undef :method_missing
def self.method_missing(method, *args, &block)
scope method, block
end
@jpfuentes2
jpfuentes2 / rbenv-install-system-wide.sh
Created March 8, 2012 19:47
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
@jpfuentes2
jpfuentes2 / server.rb
Created April 21, 2012 01:38
client WS
require 'bundler/setup'
Bundler.setup
require "eventmachine"
require "em-websocket"
EM.run do
channel = EM::Channel.new
EM::WebSocket.start(host: "0.0.0.0", port: 2092, debug: true) do |ws|
ws.onopen do
@jpfuentes2
jpfuentes2 / gist:3708381
Created September 12, 2012 17:25
zombie.js testing
Zombie = require "zombie"
assert = require("chai").assert
$ = require "jquery"
describe "When first visiting the time entry page", ->
before (done) ->
@browser = new Zombie
@browser.visit("http://localhost:4567").then done, done
@jpfuentes2
jpfuentes2 / map.js
Last active December 10, 2015 21:38 — forked from zor/gist:4496523
drawLandmarks: function() {
var parent = this;
var createListenter = function(shapeMarker, landmark) {
google.maps.event.addListener(shapeMarker, 'click', function() {
parent.setLocation('activity', landmark.id, landmark.name, shapeMarker);
});
}
for (var i = 0, landmark; landmark = this.landmarkData[i]; i++) {
if(landmark.type == "circle") {
--type-add=ruby=.ru
--type-set=haml=.haml
--type-set=sass=.sass,.scss
--type-add=html=.haml
--type-add=css=.sass,.scss
--type-add=html=.tpl
#!/bin/sh
bundle install --binstubs
bundle exec rake db:drop RAILS_ENV=development
bundle exec rake db:drop RAILS_ENV=test
bundle exec rake db:create:all
bundle exec rake db:setup
bundle exec rake db:development:accounts
echo "
require 'rack'
require 'sinatra/base'
class App < Sinatra::Base
use Rack::Static, :urls => ["/js"], :root => '.'
not_found do
halt 404, "nawp"
end