Skip to content

Instantly share code, notes, and snippets.

View yashprit's full-sized avatar
💭
I may be slow to respond.

Yashprit yashprit

💭
I may be slow to respond.
View GitHub Profile
@yashprit
yashprit / moving_to_scss.css.scss
Created September 3, 2014 13:44
Typical SCSS code
/* this is how a partials will look like*/
@import "../mixins/box-shadow";
@import "../mixins/error-message";
@import "../mixins/font-variant";
@import "../mixins/text-align";
@import "../mixins/variables";
/*This is how typical a mixin look like*/
@mixin box-shadow($top, $left, $blur, $color, $inset:"") {
-webkit-box-shadow:$top $left $blur $color #{$inset};
@yashprit
yashprit / acl.js
Last active August 29, 2015 14:05
var authorised = module.exports = function(req, res, next) {
//check for cdc token
return function(role) {
//check roles with userid in userRoleLookupTable
}
};
var access = authorised();
@yashprit
yashprit / gulp_task_git_command.js
Last active August 29, 2015 14:05
gulp task for reading git SHA1
gulp.task('add:deployment', function (cb) {
var command = 'git rev-parse HEAD';
var deploymentFile = 'source/js/common/deployment.js';
exec(command, function (err, stdout, stderr) {
if(err) {
cb(err);
gutil.log("Executing '" + command + " fails");
throw new Error("error occured while executing command " + command);
}
var jsCode = "window.deploymentNumber = " + stdout;
@yashprit
yashprit / server_responce.js
Created August 13, 2014 12:55
errors_server
{
code: 500,
message: "something goes wrong",
responce: {}
}
@yashprit
yashprit / errorcode.js
Created August 13, 2014 12:52
webclient_errorcode
var errorcode = {
500: "server is not avaible",
getMessage: function (code) {
return this[code]
}
}
@yashprit
yashprit / process_monitor.sh
Created July 10, 2014 09:08
Monitor processing running on system, with single argument as process
#!/bin/bash
if [ $EUID != 0 ]
then
echo "Please run as root"
exit
fi
if [ "$1" == "" ]
then
echo "No process name provided"
@yashprit
yashprit / shell_learning.sh
Last active August 29, 2015 14:03
Shell Learning, small utility
Using tr for separating words and then grep and wc seems possible :
tr -s ' ' '\n' < file.txt | grep file | wc -l
function foo(){
return Promise.all(["http://jsonplaceholder.typicode.com/posts/1", "http://jsonplaceholder.typicode.com/comments/1"]);
}
function task2(e){
alert("In two got " + e);
return " Two ";
}
function task3(e){
alert("In three got " + e);
return " Three ";
@yashprit
yashprit / python_webserver.md
Last active August 29, 2015 14:02
Simple Python server on mac

You can open html file in browser, but browser open it with file:///, serving everything from file system is not possible, I mean working with ThreeJS, ploymer you need to run everything on web server. So here is very simple web server using Python on Mac

  1. Go to directory (your development) where you need to serve file using web server
  2. Type python -m SimpleHTTPServer 8000
  3. open in browser http://localhost:8000/<name_of_file>.html

You can see file serving from web server, instead of file:///

@yashprit
yashprit / Sublime_Shortcut.md
Last active August 29, 2015 14:02
Sublime Shortcut

Use Ctrl + P, its a GoTo Anything Popup:-

  1. Type, to search through files (open files, recently closed files, and files in open folders)

  2. @foo, to search through symbols in the current file

  3. :foo, to go to the given line number

  4. #foo, to do a fuzzy search in the current file for foo