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
$('#snippet_snippet').click -> | |
$('#snippet_info').show('slow') |
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
$("#snippet_snippet").click -> | |
$("#snippet_info").show('slow') |
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
$("#snippet_snippet").click -> | |
$("#snippet_info").show('slow') |
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 'xmpp4r/httpbinding/client' | |
@client = Jabber::HTTPBinding::Client.new("[email protected]") | |
@client.connect("http://example.com/http-bind") | |
@client.auth("password") | |
sid = @client.instance_variable_get("@http_sid") | |
rid = @client.instance_variable_get("@http_rid") | |
puts sid |
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
loop do | |
time.sleep | |
# run the code | |
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
# To store the application settings in a key value pair | |
# Type will store the data type so that the conversion can be | |
# done within the model before send | |
class Temp | |
include DataMapper::Resource | |
# Primary (serial) key | |
property :id, Serial |
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 | |
/* *** WHMCS JSON API Sample Code *** */ | |
$url = "localhost/order/includes/api.php"; # URL to WHMCS API file goes here | |
$username = "user"; # Admin username goes here | |
$password = "passs"; # Admin password goes here | |
$postfields = array(); | |
$postfields["username"] = $username; | |
$postfields["password"] = md5($password); |
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 apt-get install ruby1.9.1 ruby1.9.1-dev \ | |
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \ | |
build-essential | |
#install sqlite3 | |
sudo apt-get install libsqlite3-dev | |
#to test if the installation process went smoothly | |
#type the following commadn |
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 'resolv' | |
class MxRecordValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
mail_servers = Resolv::DNS.open.getresources(value.split('@')[1], Resolv::DNS::Resource::IN::MX) | |
if mail_servers.empty? then | |
record.errors[attribute] << "Does not have a MX record assosiated with mail id" | |
end | |
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
Gem::Specification.new do |s| | |
s.name = 'sample' | |
s.version = '0.1.1' | |
s.date = '2013-03-19' | |
s.summary = "Sample gemspec file" | |
s.description = "A sample gemspec file I use to explain about installing executable files" | |
s.authors = ["Harisankar P S"] | |
s.email = ['[email protected]'] | |
s.files = [ | |
"bin/am_here"] |