Skip to content

Instantly share code, notes, and snippets.

View endorama's full-sized avatar
:shipit:

Edoardo Tenani endorama

:shipit:
View GitHub Profile
@endorama
endorama / angular-loadscript.js
Last active October 11, 2018 07:28
AngularJS 1.2.0 lazy load script in partials
/*
* Angular LoadScript
*
* Let angular load and execute lazy javascript from partials!
*
* This module is the result of this issue: "1.2.0rc1 regression: script tags not loaded via ngInclude"
* Issue url: https://github.com/angular/angular.js/issues/3756
*
* As of Angular 1.2.0 the ngInclude scripts does not permit execution of javascript from included partials.
* This little module execute code inside script tags with "javascript-lazy" attribute after partial loading,
@endorama
endorama / bash-file.sh
Last active September 19, 2022 21:47
Bash template file
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT="$(readlink --canonicalize-existing "$0")"
SCRIPTPATH="$(dirname "$SCRIPT")"
SCRIPTNAME="$(basename "$SCRIPT")"
# Thanks https://dev.to/thiht/shell-scripts-matter :)
# set -x if DEBUG env var is set - any value suffice
[ -z "${DEBUG:-}" && set -x
@endorama
endorama / setup_load_paths.rb
Created September 4, 2013 16:36
Update RVM loading for Passenger 4, Rails 3 and newer RVM versions ( >= 1.20.11 ). Reference here: http://joncairns.com/2013/06/using-project-specific-gemsets-with-rails-rvm-and-passenger/
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
end
end
@endorama
endorama / setup_load_paths.rb
Created July 1, 2013 17:04
Rails 3 setup file for Passenger + Nginx + RVM integration. Place it in `config/`. See more at: http://everydayrails.com/2010/09/13/rvm-project-gemsets.html#sthash.Wzk2ZGsr.dpuf
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
#$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."