basic CSS template for A4 print
BONUS: includes style for A2 and A5!
A Pen by rafaelcastrocouto on CodePen.
basic CSS template for A4 print
BONUS: includes style for A2 and A5!
A Pen by rafaelcastrocouto on CodePen.
# Sidekiq interaction and startup script | |
commands: | |
create_post_dir: | |
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh": | |
mode: "000755" | |
owner: root | |
group: root |
Using gem aws-sdk for a ror application for uploading images to s3 | |
Uploading images to a fixed bucket with different folders for each object or application. | |
The s3 keeps a limitation on the number of buckets creattion whereas there is no | |
limitation for content inside a bucket. | |
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public | |
so that the images uploaded are directly accessible. The input it takes is the image complete path | |
where it is present, folder in which it should be uploaded and user_id for whom it should | |
be uploaded. |
# Main reference was lascarides' post at http://stackoverflow.com/questions/14743447/getting-pdf-from-wickedpdf-for-attachment-via-carrierwave | |
# estimate.rb | |
# ... | |
has_attached_file :pdf, | |
storage: :s3, | |
s3_credentials: { | |
access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | |
bucket: ENV['AWS_BUCKET'] |
sudo service elasticsearch stop | |
if ! [ -e .semaphore-cache/elasticsearch-2.4.4.deb ]; then (cd .semaphore-cache; curl -OL https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.4/elasticsearch-2.4.4.deb); fi | |
echo Y | sudo dpkg -i .semaphore-cache/elasticsearch-2.4.4.deb | |
sudo sh -c "echo 'script.inline: true' >> /etc/elasticsearch/elasticsearch.yml" | |
sudo sh -c "echo 'script.groovy.sandbox.enabled: true' >> /etc/elasticsearch/elasticsearch.yml" | |
sudo sh -c "echo 'index.number_of_replicas: 0' >> /etc/elasticsearch/elasticsearch.yml" | |
sudo sh -c "echo 'index.number_of_shards: 1' >> /etc/elasticsearch/elasticsearch.yml" | |
sudo service elasticsearch start | |
sleep 10 && curl -XGET 'localhost:9200' |
#!/bin/bash | |
# Install a custom ElasticSearch version - https://www.elastic.co/products/elasticsearch | |
# | |
# To run this script on SemaphoreCI, add the following command to your project's build setup: | |
# \curl -sSL <RAW_URL_FOR_THIS_SCRIPT> | bash -s | |
# | |
ELASTICSEARCH_VERSION="0.90.13" | |
ELASTICSEARCH_PORT="9200" | |
ELASTICSEARCH_DIR="$SEMAPHORE_PROJECT_DIR/elasticsearch" | |
ELASTICSEARCH_WAIT_TIME="15" |
class FormUser < User | |
attr_accessor :current_password | |
validates_presence_of :email, if: :email_required? | |
validates_uniqueness_of :email, allow_blank: true, if: :email_changed? | |
validates_format_of :email, with: Devise.email_regexp, allow_blank: true, if: :email_changed? | |
validates_presence_of :password, if: :password_required? | |
validates_confirmation_of :password, if: :password_required? | |
validates_length_of :password, within: Devise.password_length, allow_blank: true |
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
require 'date' | |
require 'gmail' | |
require 'yaml' | |
#google-api-clientはv0.6.4が必要です | |
require "google/api_client" |
require 'oauth' | |
require 'oauth2' | |
class ContactImporter | |
def initialize(importer) | |
@importer = importer | |
end | |
def authorize_url | |
case @importer |
# The OAuth access token provided by the Google API expires in 60 minutes. After expiration, | |
# you must exchange a refresh token for a new access token. Unfortunately, the the Google API | |
# ruby gem does not include a method for refreshing access tokens. | |
# You can read up on how to refresh an access token here: | |
# https://developers.google.com/accounts/docs/OAuth2WebServer#refresh | |
# This Token model implements that process. It's based off of a Token model that can be created | |
# by running: | |
# rails g model Token token:text refresh_token:string expires_at:datetime |