Copy the following into a shell script in fedena's root folder, give it executable permissions and run as :
./update_plugin_assets.sh vendor/plugins/my_awesome_plugin
#!/bin/sh
plugin_dir=$1
while inotifywait -r -e modify $plugin_dir ; do
require 'rubygems' | |
gem 'prawn','=0.6.3' | |
require 'prawn' | |
words = "പോടാ മണ്ട is the new foo bar." | |
Prawn::Document.generate "example.pdf" do |pdf| | |
pdf.font 'rachana.ttf' | |
pdf.text words | |
end |
# encoding: UTF-8 | |
require 'yaml' | |
sf = File.open("original_ml.yml", "r") | |
src = YAML::load(sf.read) | |
sf.close | |
rf = File.open("current_en.yml", "r") | |
ref = YAML::load(rf.read) | |
rf.close |
def get_stylesheets | |
styles_path = "#{Rails.root}/public/stylesheets" | |
controller_name = controller.controller_path | |
action_name = controller.action_name | |
if File.exists? "#{styles_path}/#{controller_name}/#{action_name}.css" | |
"#{controller_name}/#{action_name}" | |
elsif ["create","edit","update"].include? action_name and File.exists? " #{styles_path}/#{controller_name}/new.css" | |
"#{controller_name}/new" | |
end | |
end |
#!/usr/bin/env ruby | |
module PasswordChecker | |
def check_valid? | |
if length > 1 | |
(length/2).times { |i| | |
return false if (self[(i+1..length)].start_with? self[(0..i)]) | |
} | |
(self[(1..length)]).check_valid? | |
else | |
return true |
curl -s http://checkip.dyndns.com/|cut -d ":" -f 2|cut -d "<" -f 1 | |
#You might want to alias this thing to something shorter. `checkip` in my case. |
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "mysql", | |
:host => "localhost", | |
:username => "myuser", | |
:password => "mypass", | |
:database => "somedatabase" |
task :test do | |
require 'rake/runtest' | |
$: << 'lib' << '.' | |
Rake.run_tests 'test/unit/*_test.rb' | |
end | |
namespace :test do | |
desc "Test ROXML under the Nokogiri parser" | |
task :nokogiri do |
Copy the following into a shell script in fedena's root folder, give it executable permissions and run as :
./update_plugin_assets.sh vendor/plugins/my_awesome_plugin
#!/bin/sh
plugin_dir=$1
while inotifywait -r -e modify $plugin_dir ; do
desc 'Run Devise tests for all ORMs.' | |
task :tests do | |
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file| | |
orm = File.basename(file).split(".").first | |
system "rake test DEVISE_ORM=#{orm}" | |
end | |
end | |
task :default => :tests |
#!/usr/bin/env ruby | |
file = "/home/srih4ri/code/rm_current_clem/to_delete.txt" | |
require "dbus" | |
sesbus = DBus.session_bus | |
clem_service = sesbus["org.mpris.clementine"] | |
clem_object = clem_service.object "/Player" | |
clem_object.introspect | |
clem_iface = clem_object['org.freedesktop.MediaPlayer'] | |
meta = clem_iface.GetMetadata | |
file_loc = meta[0]['location'].split('file://').last |