Skip to content

Instantly share code, notes, and snippets.

View itsbalamurali's full-sized avatar
🎯
Focusing

Balamurali Pandranki itsbalamurali

🎯
Focusing
View GitHub Profile
@itsbalamurali
itsbalamurali / gravatar_function.php
Created November 27, 2012 07:08
Simple PHP Gravatar Function
<?php
/**
Load a gravatar.
*/
function gravatar($email = '', $rating = 'pg') {
$default = "path/to/defava.png"; // Set a Default Avatar
$email = md5(strtolower(trim($email)));
$gravurl = "http://www.gravatar.com/avatar/$email?d=$default&s=60&r=$rating";
return '<img src="'.$gravurl.'" width="60" height="60" border="0" alt="Avatar">';
#
# Inspired by
# http://dev.rubyonrails.org/svn/rails/plugins/account_location/lib/account_location.rb
#
module SubdomainAccounts
def self.included( controller )
controller.helper_method(:account_domain, :account_subdomain, :account_url, :current_account, :default_account_subdomain, :default_account_url)
end
protected
@itsbalamurali
itsbalamurali / chat.rb
Created October 20, 2013 16:09 — forked from rkh/chat.rb
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
require 'hub'
run Sinatra::Application
require 'hub'
run Sinatra::Application
<?php
echo "<h1>PHP Code to find the common alphabets in AMITABH BACHCHAN and RAJNIKANTH</h1>";
$string1 = "AMITABH BACHCHAN";
$string2 = "RAJNIKANTH";
$a1 = strlen($string1);
$a2 = strlen($string2);
echo "common alphabets in AMITABH BACHCHAN AND RAJNIKANTH are :\n";
for($i = 0;$i<$a1;$i++)
{
for($j=0;$j<$a2;$j++)
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
wget https://github.com/downloads/github/hubot/hubot-1.1.9.tar.gz
tar zxvf hubot-*.tar.gz
cd hubot
vim Procfile
app: bin/hubot -a gtalk -n Hubot
vim bin/hubot
#npm install
#heroku logs will be more silence the error if remove the npm install from bin/hubot
git init
@itsbalamurali
itsbalamurali / base.rb
Created December 31, 2013 08:25 — forked from bensie/base.rb
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
<?php
date_default_timezone_set('Europe/London'); // Set this to your local timezone - http://www.php.net/manual/en/timezones.php
/**
* The root directory where the repos live.
*
* @var string
*/
$root_dir = '/your/root/dir/';