Skip to content

Instantly share code, notes, and snippets.

@marufsiddiqui
marufsiddiqui / hw4.4.js
Created November 18, 2013 08:53
Homework: Homework 4.4 In this problem you will analyze a profile log taken from a mongoDB instance. You should have included with your homework files a 'sysprofile.json' file. Import this file with the following command: mongoimport -d m101 -c profile < sysprofile.json Now query the profile data, looking for all queries to the students collecti…
db.profile.find({ns:'school2.students'}).sort({millis:-1}).pretty()
!(function (ng) {
'use strict';
ng.module('jquery', ['jquery.directives']);
var jqdir = ng.module('jquery.directives', []);
function tokenInput($parse, $timeout) {
return {
restrict: 'A',
require: '?ngModel',
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$photoName = $_GET['photo'];
$s3ImgUri = S3_IMG_URL . $photoName;
$localImg = IMAGES . 'email_image' . DS . $photoName;
// Create the image in local
copy($s3ImgUri, $localImg);
@marufsiddiqui
marufsiddiqui / LexicalSearchDirective.js
Created December 23, 2013 11:20
Reset functionality
scope.resetImageSearch = function () {
scope.advancedImageSearch = {};
$timeout(function () {
element.find('.filter-panel select').trigger('chosen:updated');
});
};
scope.$watch('advancedImageSearch', function (newVal) {
if (Object.keys(newVal).length) {
scope.getApiCall();
duAsync4 = (dir,cb) ->
total = 0
file_counter = 1 #starts at one because of the initial directory
async_running = 0
again = (current_dir) ->
fs.lstat current_dir, (err, stat) ->
if err then file_counter--; return
if stat.isFile()
file_counter--
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {
<?php if (!$this->request->is('mobile')) { ?>
<a href="<?php echo $host.'/events/trace_share/'.$event_email_id.'/?media=ig&share_url='.$ig_share. '&image_url='.$share_url; ?>"
style="margin: 0;padding: 0;color: #2BA6CB;"><img
alt="Share on Instagram"
src="http://www.pixta.com.au/img/email_image/def-ig-share.png"
style="display: block;margin: 0;padding: 0;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;max-width: 100%;"></a>
<?php } ?>
var tasks = [{
name: 'asdf',
status: 'scheduled'
},{
name: 'asdf1',
status: 'open'
},{
name: 'asdf2',
status: 'scheduled'
},{
@marufsiddiqui
marufsiddiqui / net.js
Last active August 29, 2015 13:56
Check internet connectivity
var dns = require('dns'),
timer;
var exec = require('child_process').exec;
function checkInternet() {
console.log('Checking internet again at ' + getTime());
dns.resolve('www.google.com', function(err, c) {
if (err || c[0] === '204.13.161.111') {
console.log(err);
console.log('Internet connection is not available at ' + getTime());