Skip to content

Instantly share code, notes, and snippets.

View oniram88's full-sized avatar

Marino Bonetti oniram88

  • Archimedianet
  • Gavardo,Brescia,Italy
View GitHub Profile
@oniram88
oniram88 / example.rb
Last active July 25, 2023 04:32
validated? example
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails"
@oniram88
oniram88 / alchemy_cache_clear.rake
Created June 25, 2019 10:59
Simple Rake Task to clear Alchemy cache after deploy new site templates
namespace :alchemy do
namespace :cache do
desc "Complete Clear the cache of all pages"
task full_clear: [:environment] do
Alchemy::Language.published.each do |l|
l.pages.flushables.update_all(published_at: Time.current)
l.pages.flushable_layoutpages.update_all(published_at: Time.current)
end
@oniram88
oniram88 / DownloadFile.js
Last active December 4, 2017 13:09
File Download
Ext.define( 'DownloadFile', {
requires:['Ext.form.Panel'],
downloadFile:function ( config ) {
config = config || {};
var url = config.url,
method = config.method || 'POST',// Either GET or POST. Default is POST.
params = config.params || {};
@oniram88
oniram88 / output error
Last active January 4, 2016 09:29
Odroid U3 Therubyracer compilation fail
gem install therubyracer --platform=ruby
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile
make clean
@oniram88
oniram88 / gist:5743448
Created June 9, 2013 13:07
ExtJS - Ruby on Rails - WARNING: Can't verify CSRF token authenticity workaround to verify csrf token in every ajax request.
Ext.Ajax.defaultHeaders = {'Accept':'application/json'};
Ext.Ajax.on('beforerequest', function (o) {
var csrf = Ext.select("meta[name='csrf-token']").first();
if (csrf) {
o.defaultHeaders = Ext.apply(o.defaultHeaders || {}, {'X-CSRF-Token':csrf.getAttribute('content')});
}
});