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
def self.get_audio_length(filepath) | |
pipe = "ffmpeg -i "+ filepath.to_s+" 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//" | |
command = `#{pipe}` | |
if command =~ /([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/ | |
#convert the result to only secs | |
duration = ($2.to_i * 60) + $3.to_i | |
end | |
#return and array containing the seconds and the human readable time length, ["6453","03:54"] | |
return "#{duration.to_s},#{$2}:#{$3}".split(",") | |
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
require 'rubygems' | |
require 'rye' | |
HOST = "yourserver" | |
USER = "username" | |
PASS = "password" | |
app_path = "/path/to/rails_app_root" | |
production_env = "RAILS_ENV=production" |
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
<?php | |
MPower_Setup::setMasterKey("dd6f2c90-f075-012f-5b69-00155d866600"); | |
MPower_Setup::setPublicKey("test_public_oDLVlm1eNyh0IsetdhdJvcl0ygA"); | |
MPower_Setup::setPrivateKey("test_private_zzF3ywvX9DE-OSDNhUqKoaTI4wc"); | |
MPower_Setup::setMode("test"); | |
MPower_Setup::setToken("ca03737cf942cf644f36"); |
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
<?php | |
//Setup your Store information | |
MPower_Checkout_Store::setName("My Awesome Online Store"); | |
MPower_Checkout_Store::setTagline("My awesome store's awesome tagline"); | |
MPower_Checkout_Store::setPhoneNumber("0302507099"); | |
MPower_Checkout_Store::setPostalAddress("Post office Box AN 10604"); |
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
require('mpower/mpower.php'); |
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
<?php | |
/* Adding items to your invoice is very basic, the parameters expected are | |
name_of_item, quantity, unit_price, total_price and optional item | |
description. */ | |
$invoice->addItem("13' Apple Retina 500 HDD",1,10.99,10.99); | |
$invoice->addItem("Case Logic laptop Bag",2,100.50,201,"Optional description"); | |
$invoice->addItem("Philips electric shaver",2,50.50,101.00); | |
/* You can optionally set a general invoice description text which can | |
be used in cases where your invoice does not need an items list or in cases |
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
<?php | |
$invoice->setTotalAmount(1200.99); |
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
<?php | |
// The parameters for setting add tax are title_of_the_tax, tax_amount | |
$invoice->addTax('VAT (15%)',50); | |
$invoice->addTax('NHIL (5%)',50); |
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
<?php | |
// Globally setting cancel URL, the piece of code below | |
// should be included with the checkout shop setup code | |
MPower_Checkout_Store::setCancelUrl("http://www.myawesomeshop.com/"); | |
// Setting the cancel URL on an invoice instance. | |
// This will overwrite any global settings for cancel URL | |
$invoice->setCancelUrl("http://www.myawesomeshop.com/"); |
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
<?php | |
// The code below depicts how to create the checkout invoice on our servers | |
// and redirect to the checkout page. | |
if($invoice->create()) { | |
header("Location: ".$invoice->getInvoiceUrl()); | |
}else{ | |
echo $invoice->response_text; | |
} |
OlderNewer