Skip to content

Instantly share code, notes, and snippets.

View sajanp's full-sized avatar

Sajan Parikh sajanp

  • COS Systems
  • Pittsburgh, PA
View GitHub Profile
@sajanp
sajanp / php-nav-list-active.php
Created December 27, 2012 21:14
An example of using shorthand if/else to conditionally use an 'active' class on a nav list item.
<li class="<?= ($nav_active == 1 ? 'active' : ''); ?>"><a href="#">Home</a></li>
// If $nav_active equals the integer 1 then echo 'active' else echo '' (nothing)
@sajanp
sajanp / steam-system-info.txt
Created December 28, 2012 10:34
System information for steam debugging.
Processor Information:
Vendor: GenuineIntel
Speed: 2400 Mhz
4 logical processors
4 physical processors
HyperThreading: Unsupported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
@sajanp
sajanp / CrashPlan.desktop
Created December 28, 2012 23:22
Desktop launcher for CrashPlan on Ubuntu 12.10. This file should be saved as /usr/share/applications/CrashPlan.desktop after you've installed CrashPlan. http://youtu.be/M6yBe8Gh3O4
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=CrashPlan
Categories=System;
Comment=CrashPlan Desktop
Exec=/usr/local/bin/CrashPlanDesktop
Icon=/usr/local/crashplan/skin/icon_app_128x128.png
Hidden=false
Terminal=false
@sajanp
sajanp / AptanaStudio3.desktop
Last active December 11, 2015 19:39
Desktop launcher for Aptana Studio 3. Requires Aptana to be unzipped into /opt and the included icon.xpm be convered to icon.png.
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Aptana Studio 3
GenericName=Integrated Development Environment
Comment=Aptana Strudio 3 Integrated Development Environment
Exec=/opt/Aptana_Studio_3/AptanaStudio3 %F
TryExec=/opt/Aptana_Studio_3/AptanaStudio3
Icon=/opt/Aptana_Studio_3/icon.png
StartupNotify=true
@sajanp
sajanp / .htaccess
Created January 27, 2013 23:34
CodeIgniter .htaccess file. Check the baseurl and default controller on line 10.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(main(/index)?|index(\.php)?)/?$ / [L,R=301]
# Rerun the install script, recording the files installed.
python setup.py install --record files.txt
# Then, loop through the file removing everything.
cat files.txt | xargs rm -rf
@sajanp
sajanp / email-signature
Last active December 11, 2015 21:49
My email signature for Thunderbird. Hate having to log into Amazon S3 and get the URL of the logo image and retype everything. Although, as I'm typing this description, I just realized I could copy and paste this signature from any email in my sent folder. Doh!
Sajan Parikh<br />
<i>Owner, Noppix LLC</i><br /><br />
e: sajan@noppix.com<br />
o: (563) 726-0371<br />
c: (563) 447-0822<br /><br />
<img alt="Noppix LLC Logo" src="https://s3.amazonaws.com/Noppix_Media/Email_Signatures/NewNoppixEmailLogo.png" />
@sajanp
sajanp / alpha_num_spaces.php
Last active December 12, 2015 02:18
CodeIgnitor form validation class to allow only alphanum and spaces. My regex is ABSOLUTELY terrible (whose isn't?), so...this may not work and needs to be tested. If you find that the regex pattern needs to be tweaked, please come back and edit this gist.
<?php
function alpha_num_spaces($subject)
{
$pattern = "#^[A-Z0-9 ]+$#i";
$res = preg_match($pattern, $subject);
if ($res == 1)
{
@sajanp
sajanp / twilio.php
Last active December 12, 2015 10:09
Quick two files to have Zendesk post to zendesk.php on a trigger, which will then ask Twilio to go to twilio.php and do stuff. Like call you and text you. You will need to load the Twilio PHP helper.
<?php
include 'Twilio.class.php';
$subject = urldecode($_GET['subject']);
$response = new Services_Twilio_Twiml();
$response->say('Hello. New Zen desk ticket.');
$response->pause("");
$response->say($subject);
$response->sms(
'New support ticket: ' . $subject,
<?php
$numbers = array(
mt_rand(1, 200),
mt_rand(1, 200)
);
echo $json_encode($numbers);
?>