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 / 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 / server_responce.js
Created August 13, 2014 12:55
errors_server
{
code: 500,
message: "something goes wrong",
responce: {}
}
@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 / 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 / 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 / cleaning_git.md
Last active August 29, 2015 14:06
Cleaning up git repository
  1. Check the size du .git/object or git count-objects -v
  2. find unwanted files git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch filename' --prune-empty -f -- --all
  3. Reclaim space
rm -rf .git/refs/original/\n
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
@yashprit
yashprit / nodejs_app_structure
Last active August 29, 2015 14:07
Node js file structure
.
├── Gemfile
├── Rakefile
├── app
│   ├── controller
│   ├── dao
│   ├── middleware
│   ├── util
│   └── views
├── app.js
@yashprit
yashprit / bad_request.js
Created October 12, 2014 09:35
Error handling in NodeJS
//sub object, filename = badrequest.js
var Exception = require('./exception')
, inherits = require('util').inherits;
function BadRequest(message, uiMessage){
var code = 400;
Exception.call(this, code, message, uiMessage);
}
inherits(BadRequest, Exception);
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
@yashprit
yashprit / node-webkit_local_development.md
Last active August 29, 2015 14:08
Node Webkit local development

Text taken from here

Sublime Text 2 is a great cross-platform editor for building node-webkit apps, you can download it here:

###Mac OS X

Download node-webkit.app and place it in /Applications folder From the Sublime Text 2 menu select Tools -> Build System -> New Build System Enter the following code: