Skip to content

Instantly share code, notes, and snippets.

View muhamed-didovic's full-sized avatar
😎

Muhamed muhamed-didovic

😎
View GitHub Profile
var base_path = __dirname.replace('resources/nodejs', '');
require('dotenv').config({
path: base_path+'.env'
});
var port = process.env.NODE_SERVER_PORT,
redis = require('redis'),
redis_client = redis.createClient(),
cookie = require('cookie'),
os = require('os'),

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
/*
See dev dependencies https://gist.github.com/isimmons/8927890
Compiles sass to compressed css with autoprefixing
Compiles coffee to javascript
Livereloads on changes to coffee, sass, and blade templates
Runs PHPUnit tests
Watches sass, coffee, blade, and phpunit
Default tasks sass, coffee, phpunit, watch
*/
(function() {
function DateDiff(date1, date2) {
this.days = null;
this.hours = null;
this.minutes = null;
this.seconds = null;
this.date1 = date1;
this.date2 = date2;
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
@muhamed-didovic
muhamed-didovic / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Here's the base sanitizer:

<?php

namespace FooProject\Internal\Sanitizers;

abstract class BaseSanitizer
{
    /**
function meThinks(assertion) {
return {
shouldEqual: function(bool) {
if ( assertion !== bool ) {
throw new Error('FAIL');
}
}
};
}
$.getJSON('http://173.255.193.46/api/edge/popular:themeforest.json?callback=?', function(files) {
var imgs;
files = files.popular;
console.log(files); // see what's available to play with
imgs = $.map(files.items_last_week, function(file, i) {
return '<a href="' + file.url + '"><img src=' + file.thumbnail + '></a>';
});