Skip to content

Instantly share code, notes, and snippets.

View kaliaparijat's full-sized avatar

Parijat Kalia kaliaparijat

  • San Francisco
View GitHub Profile
function omit(obj, keys){
if (typeof obj != 'object') {
console.log("this is not an object");
return obj;
}
var omitThisKey;
if (keys instanceof Array) {
omitThisKey = function(key) {
db.results.aggregate([
{
$match: {
$and:[
{
"profile.Zend_Http_Client_Adapter_Curl::write==>curl_exec": {
"$exists": true }
},
{
"profile.main().wt": {
db.results.aggregate([
{
$match: {
$and:[
{
"profile.Zend_Http_Client_Adapter_Socket::read==>fgets": {
"$exists": true }
},
{
"profile.main().wt": {
MongoDB shell version: 2.0.4
connecting to: localhost:27017/xhprof
Thu Mar 20 16:40:23 SyntaxError: missing : after property id (shell eval):1
MongoDB shell version: 2.0.4
connecting to: localhost:27017/xhprof
{
"_id" : ObjectId("532a2a986803faba658b456b"),
"profile" : {
"main()==>register_shutdown_function" : {
"ct" : 1,
@kaliaparijat
kaliaparijat / LinkedList.js
Created January 2, 2013 19:30
Javascript implementation of a customized LinkedList. I use this as the slides for a custom jQuery carousel that is limited to only 2 list elements.
function LinkedList(){};
LinkedList.prototype = {
length:0,
first:null,
last:null,
cursor:null
}
LinkedList.DoubleCircular = function(){};
LinkedList.prototype.isEmpty = function(){
if(this.length == 0)
@kaliaparijat
kaliaparijat / jQuery sample
Created August 23, 2012 23:16
jQuery accordion and jQuery tabbed browser: Both are separate libraries,included together for demonstrative purposes
<script type = "text/javascript" charset = "utf-8">
$(document).ready(accordion() ) ;
function accordion()
{
$('#critical_reading').show();
$('.head').click(function(e) { // binding an event handler to all elements that belong to the class head, in this case hyper links
$(this).closest('li').find('.topics').slideToggle()
$(this).closest('li').next().find('.topics').slideUp();
$(this).closest('li').prev().find('.topics').slideUp();
@kaliaparijat
kaliaparijat / gist:3307612
Created August 9, 2012 20:06
CSS: The idea behind the gist is to demonstrate my capabilities with CSS stylesheets
/*
Reset CSS
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
html{color:#000;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}del,ins{text-decoration:none;}
/*
@kaliaparijat
kaliaparijat / passwords.class.php
Created July 30, 2012 20:16
Drupal Password hash class (Procedural) as a Symfony library class (OOP) :used for a scenario where a Symfony powered website requires access to user credentials that have been signed up with an existing Drupal site
<?php
/**
* @file
* Secure password hashing functions for user authentication.
*
* Based on the Portable PHP password hashing framework.
* @see http://www.openwall.com/phpass/
*
@kaliaparijat
kaliaparijat / controller.php
Created July 6, 2012 23:10
Sample coding style: Controller [Symfony framework];
public function executeQuizResults(sfWebRequest $request)
{
if($request->isMethod('post'))
{
$contentId = $request->getParameter('id');
$this->quiz = $questionsForContentId = Doctrine_Core::getTable('Questions')->findByContentId($contentId);
foreach($questionsForContentId as $questionOfContentId)
{
$questionId = $questionOfContentId->getQuestionId();
@kaliaparijat
kaliaparijat / controller.php
Created July 6, 2012 23:05
Coding style sample: Controller code for a web page, uses DOCTRINE ORM for querying
public function executeQuizResults(sfWebRequest $request)
{
if($request->isMethod('post'))
{
$contentId = $request->getParameter('id');
$this->quiz =
$questionsForContentId = Doctrine_Core::getTable('Questions')->findByContentId($contentId);
foreach($questionsForContentId as $questionOfContentId)
{