Skip to content

Instantly share code, notes, and snippets.

View antillas21's full-sized avatar

Antonio Antillon antillas21

  • Mexicali, Mexico
View GitHub Profile
@antillas21
antillas21 / carrierwave.rb
Created March 12, 2014 14:59
Carrierwave initializer file
if Rails.env.development?
CarrierWave.configure do |config|
config.storage = :file
end
elsif Rails.env.test?
CarrierWave.configure do |config|
config.storage = :file
config.enable_processing = false
end
else # production
// Generated on 2013-08-13 using generator-angular 0.3.1
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
// # Globbing
@antillas21
antillas21 / app.js
Last active August 29, 2015 14:06
ngResource config
(function(){
var app = angular.module('myApp.api', ['ngResource']);
app.factory("Clinic", ['$resource', function($resource) {
var resource = $resource("http://domain.com/api/v1/clinics/:id/:action/",
{
id: "@id",
action: "@action"
},
{
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@antillas21
antillas21 / client.rb
Created November 13, 2014 20:57
Client.search
class Client < ActiveRecord::Base
scope :search, ->(term) {
clients_table = self.arel_table
column = clients_table[:name]
where(column.matches("%#{term}%"))
}
end
@antillas21
antillas21 / application.html.erb
Created January 8, 2011 00:44
Files to edit after creating a Rails app with template: http://railswizard.org/d87652cae598fe1b11e1.rb
# in order to complete Devise initial requirements:
# app/views/layout/application.html.erb
<% flash.each do |key, value| %>
<div class='flash' id='<%= key %>'>
<%= value %>
</div>
<% end %>
@antillas21
antillas21 / qrcodes.rb
Created May 12, 2011 19:08
Creating QRCodes with rqr gem
require 'rubygems'
require 'rqr'
string = "http://google.com"
mecard = "MECARD:N:Android OS;EMAIL:android@gmail.com;URL:http://google.com;;"
RQR::QRCode.create() do |qr|
qr.save(string, "google.jpg")
end
@antillas21
antillas21 / pet_template.rb
Created January 28, 2012 02:46
SITIO BASICO: Como crear un simple sistema de plantillas para sitios web muy basicos. versión Ruby w/Sinatra
require 'sinatra'
helpers do
def partial(page)
erb page, :layout => false
end
end
get '/' do
@page_title = 'Mi pagina web'
@antillas21
antillas21 / Omega8cc Recipe
Created January 30, 2012 06:58 — forked from omega8cc/gist:960279
Import existing Drupal sites into Aegir
=== IMPORT YOUR EXISTING SITES TO AEGIR IN 8 EASY STEPS
1. Upload or rsync full drupal root of your site to static/custom/name
2. Chmod everything with command:
$ chmod -R 775 static/custom/name
and files only with:
$ chmod -R 777 static/custom/name/sites/default/files/*
@antillas21
antillas21 / gist:1741296
Created February 5, 2012 00:09
Clonar y administrar tus dotfiles
# primero colocarnos en el folder donde queremos tener nuestros dotfiles, en el ejemplo,
# directamente en el directorio de usuario
$ cd
# clonar repositorio que ya tienes
$ git clone git://github.com/badbit/dotvim.git
# esto creara el directorio dotvim en el directorio en que estábamos
$ ls -l
drwx------+ 65 aantillon staff 2210 Jan 30 02:53 dotvim