Used to provide structural templates.
Pattern
t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
Date.commercial(Date.today.year, 1+Date.today.cweek, 1) |
def upload_image | |
image = ProductImage.new | |
begin | |
# Set the path where images will be uploaded: | |
#IE9 sends a file: | |
unless params['qqfile'].is_a? String | |
upload_path = "#{image.tmp_path}/IE9_#{params['qqfile'].original_filename}" |
class String | |
# remove all non 127-ASCII chars | |
def remove_non_ascii | |
n=self.split("") | |
self.slice!(0..self.size) | |
n.each { |b| | |
if b[0].to_i< 33 || b[0].to_i>127 then | |
self.concat('') | |
else |
# How to create a excel file from any sql query | |
# @emartini86 | |
# Based on basic documentation from required gems: | |
# https://github.com/brianmario/mysql2 | |
# http://spreadsheet.rubyforge.org/file.GUIDE.html | |
require "rubygems" | |
require "mysql2" | |
require 'spreadsheet' |
#Autor: emartini | |
require ::File.expand_path('../config/environment', __FILE__) | |
require "resque/server" | |
app_name = Rack::Builder.new do | |
use Rails::Rack::LogTailer | |
use Rails::Rack::Static | |
run ActionController::Dispatcher.new | |
end |
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
include Breadcrumbs | |
# The rest of your application controller... | |
# ... | |
end |
//from Javascript: The Goods Parts | |
// http://shop.oreilly.com/product/9780596517748.do | |
Function.prototype.method = function (name, func) { | |
this.prototype[name] = func; | |
return this; | |
}; |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
brew install gfortran; | |
export FC=/usr/local/bin/gfortran; | |
brew install octave; |