This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VideosController < ApplicationController | |
before_filter :video, only: [:show, :edit, :update, :watch, :buy, :rent] | |
def update | |
authorize! :update, @video | |
if @video.update_attributes params[:video] | |
redirect_to @video | |
else | |
render :edit | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mk_setup_backup(){ | |
if [ "$#" -ne 1 ] | |
then | |
echo "Error!!!" | |
exit | |
else | |
mkdir -p $HOME/local_backups/$1 | |
d_path=`pwd` | |
cd $HOME/local_backups/$1 | |
git init --bare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get_host=`pwd` | |
PROMPT='$fg[cyan] %m $fg[blue] © git: $(git_prompt_status) $fg[yellow] rvm: $(rvm current) $fg[red] $USER $fg[green]. | |
→ $reset_color' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VICTOR_VI_COMMAND=("vthis" "vmo" "vco" "view" "vconf" "vasset") | |
VICTOR_VI_PATH=("." "app/models/" "app/controllers/" "app/views/" "config/" "app/assets/") | |
tLen=${#VICTOR_VI_COMMAND[@]} | |
tfunc="$HOME/.tmp/t1" | |
function vi_init(){ | |
for ((i=0; i < ${tLen}; i++)); | |
do | |
( | |
echo "function \$VICTOR_VI_COMMAND[\$i]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w(buy rent).each do |a| | |
define_method "user_#{a}_movies" do | |
instance_variable_get(:"@#{a}_movies").blank? ? instance_variable_set( :"@#{a}_movies", PublicActivity::Activity.where(owner_id: User.current.id, owner_type: "User", key: "video.#{a}")) : instance_variable_get(:"@#{a}_movies") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo aptitude install apache2 dnsmasq | |
$ sudo vim /etc/dnsmasq.conf | |
# ... | |
address=/dev/127.0.0.1 | |
listen-address=127.0.0.1 | |
$ sudo vim /etc/dhcp3/dhclient.conf | |
# uncomment line 20: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib/oleku/presentation.rb | |
----------------------------------------------- | |
module Oleku | |
module Presentation | |
module Video | |
def self.included base | |
base.send :include, InstanceMethods | |
end | |
module InstanceMethods | |
def method_missing( meth, *args, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dashboard::JobDescriptionsController < Dashboard::BaseController | |
skip_authorization_check | |
before_filter only: [:new, :create] { @job_description = JobDescription.send(:new, ( params[:job_description] if params[:job_description]) ) } | |
before_filter only: [:edit, :update] { @job_description = JobDescription.find(params[:id]) } | |
before_filter only: [:create, :update] do | |
if @job_description.send((@job_description.new_record? ? :save : :update_attributes), ( @job_description.new_record? ? {validate: true} : params[:job_description] )) | |
redirect_to edit_dashboard_job_description_path(@job_description), notice: "record successfuly #{params[:action]}d" | |
else | |
render params[:action] == "create" ? :new : :edit | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :vf do | |
namespace :server do | |
desc "stop server" | |
task :stop => :environment do | |
puts "-----------------Stoping Server----------------" | |
pid_file = "tmp/pids/server.pid" | |
pid = File.read(pid_file).to_i | |
puts "************pid = #{pid}" | |
Process.kill 9, pid | |
File.delete pid_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.9.1 :001 > Dir.glob("/root/projects/tellum/releases/**/public/uploads/user/photo").each do |p| | |
1.9.1 :002 > FileUtils.cp_r Dir["#{p}/*"], "/root/projects/tellum/shared/uploads/user/photo" rescue puts p | |
1.9.1 :003?> end |
OlderNewer