Skip to content

Instantly share code, notes, and snippets.

View Agowan's full-sized avatar

Niklas Lundgren Agowan

  • Boulebar
  • Stockholm Sweden
View GitHub Profile
@Agowan
Agowan / reports_controller.rb
Created June 3, 2015 08:48
Renaming files on response for expiring url.
# encoding: UTF-8
class Report < ActiveRecord::Base
has_attached_file :file, :path => "/:statistic_report_root/:year/:id_partition.pdf"
end
var validatePnr = function(str) {
if(str.length != 12)
return false;
var date_string = [str.slice(0,4),'-',str.slice(4,6),'-',str.slice(6,8)].join('');
if(isNaN(Date.parse(date_string)))
return false;
str = str.slice(2,12);
class ApiController < ActionController::Metal
include ActionController::HttpAuthentication::Token::ControllerMethods
include AbstractController::Rendering
include ActionController::Rendering
include ActionController::Renderers::All
include ActionController::ForceSSL
include ActionController::StrongParameters
include ActionController::Serialization
include ActiveSupport::Rescuable
include ActionController::Head
@Agowan
Agowan / api_controller.rb
Created August 22, 2016 11:26
Slim api base controller
# frozen_string_literal: true
module Store
class ApiController < ActionController::Metal
include ActionController::ForceSSL
include ActiveSupport::Rescuable
include AbstractController::Callbacks
include Authority::Controller
include Sorcery::Controller
include ActionController::Helpers
@Agowan
Agowan / api_controller.rb
Created September 12, 2017 12:11
Slim api with rails
# frozen_string_literal: true
module Api
class BaseController < ActionController::Metal
include ActiveSupport::Rescuable
# Add if you want to have force ssl
# include ActionController::ForceSSL
# Add if you want callbacks i.e. before_action
echo "installing"
@Agowan
Agowan / Install.md
Last active May 4, 2020 11:04
Install magento in production (external MySQL)
  1. Make sure your system is up to date
sudo apt update && sudo apt upgrade -y
  1. Create user
sudo useradd -m -U -r -d /opt/magento magento && sudo chmod 750 /opt/magento

See this tutorial to add repos and upgrade to new versions: https://thishosting.rocks/install-php-on-ubuntu/