Skip to content

Instantly share code, notes, and snippets.

View shardiwal's full-sized avatar

Rakesh Kumar Shardiwal shardiwal

  • Fagbokforlaget V&B AS
  • Gurgaon, Haryana
View GitHub Profile
@shardiwal
shardiwal / sanitize_email
Last active August 29, 2015 14:10
sanitize email.php
function sanitize_email( $content ) {
$data = array();
foreach ( ( explode(' ',$content) ) as $address) {
$email = filter_var($address,FILTER_VALIDATE_EMAIL);
if ( $email ) {
$email = preg_replace('/\./', '[dot]', $email);
$email = preg_replace('/\@/', '[at]', $email);
$data[] = $email;
}
else {
package Model::Calculation::PhysicalActivity;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Moose;
use Data::Dumper;
use Model::Response;
// flash app needs time to load and initialize
if (RecorderFlash.recorder && RecorderFlash.recorder.init) {
RecorderFlash.recorderOriginalWidth = RecorderFlash.recorder.width;
RecorderFlash.recorderOriginalHeight = RecorderFlash.recorder.height;
if (RecorderFlash.uploadFormId && $) {
var frm = $(RecorderFlash.uploadFormId);
if (frm.size() > 0) {
RecorderFlash.recorder.configure(22,0,10,100);
RecorderFlash.recorder.setUseEchoSuppression('yes');
RecorderFlash.recorder.init(frm.attr('action').toString(),RecorderFlash.uploadFieldName,frm.serializeArray());
@shardiwal
shardiwal / postconf_diff.sh
Created November 4, 2011 13:00 — forked from robinsmidsrod/postconf_diff.sh
Show Postfix configuration variables different from default
#!/bin/bash
postconf -d >/root/postfix.defaults
postconf >/root/postfix.conf
diff -u /root/postfix.defaults /root/postfix.conf | grep -v '^ '|grep -v '^@' |grep -v '^---' | grep -v '^+++'
@shardiwal
shardiwal / schedule-t20.pl
Created October 6, 2011 09:40
Indian T20 Practice Schedule
#!/usr/bin/perl
# Have a look this for the problem
#https://docs.google.com/document/d/1TyPFlDh--yp5q_NPPHX_Yd1iuUhIoZOH0hHSTabqAZw/edit?hl=en_GB&pli=1
use strict;
use warnings;
use Getopt::Std;
use DateTime;
@shardiwal
shardiwal / User.pm
Created August 4, 2011 05:44
doubt
package User;
use Moose;
use TypeConstraints qw/Gender DOB MySQLTimestamp/;
use DateTime;
use Date::Manip;
use DateTime::Format::MySQL;
has 'id' => (
@shardiwal
shardiwal / Fullonsms::Message.pm
Created August 3, 2011 07:34
API to Send SMS from FullonSMS.com
package Fullonsms::Message;
use Moose;
use Fullonsms::Util;
has 'receiver_mobile_no' => (
is => 'rw',
isa => 'ArrayRef',
required => 1
);
package Alert;
use Moose;
has 'type' => (
is => 'ro',
isa => 'Str',
required => 1,
);
@shardiwal
shardiwal / Way2sms.pm
Created July 27, 2011 08:54
API to send sms via Way2SMS.com
package Way2sms;
use Moose;
use LWP::UserAgent;
use HTTP::Cookies;
has 'username' => (
is => 'rw',
isa => 'Str',