Skip to content

Instantly share code, notes, and snippets.

Avatar

Antonio Antillon antillas21

View GitHub Profile
@antillas21
antillas21 / carrierwave.rb
Created Mar 12, 2014
Carrierwave initializer file
View carrierwave.rb
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
View Gruntfile.js
// 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 Aug 29, 2015
ngResource config
View app.js
(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"
},
{
View rspec_model_testing_template.rb
# 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:
View client.rb
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 Jan 8, 2011
Files to edit after creating a Rails app with template: http://railswizard.org/d87652cae598fe1b11e1.rb
View application.html.erb
# 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
Creating QRCodes with rqr gem
View qrcodes.rb
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 Jan 28, 2012
SITIO BASICO: Como crear un simple sistema de plantillas para sitios web muy basicos. versión Ruby w/Sinatra
View pet_template.rb
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 Jan 30, 2012 — forked from omega8cc/gist:960279
Import existing Drupal sites into Aegir
View Omega8cc Recipe
=== 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 Feb 5, 2012
Clonar y administrar tus dotfiles
View gist:1741296
# 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
You can’t perform that action at this time.