Skip to content

Instantly share code, notes, and snippets.

View ivan-marquez's full-sized avatar

Jose Ivan Marquez ivan-marquez

View GitHub Profile
@ivan-marquez
ivan-marquez / CreatedAndModifiedDateInterceptor.cs
Created April 14, 2016 03:01 — forked from marisks/CreatedAndModifiedDateInterceptor.cs
Entity Framework soft delete, modiefied and created date interceptors
using System;
using System.Data.Entity.Core.Common.CommandTrees;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Infrastructure.Interception;
using System.Linq;
public class CreatedAndModifiedDateInterceptor : IDbCommandTreeInterceptor
{
public const string CreatedColumnName = "Created";
public const string ModifiedColumnName = "Modified";
@ivan-marquez
ivan-marquez / namespaces.js
Last active July 18, 2016 19:52
Namespace example
//#region "namespace fwpr.controls"
(function () {
this.fwpr = this.fwpr || {};
this.fwpr.controls = this.fwpr.controls || {};
var ns = this.fwpr.controls;
ns.getControl = function (fieldName) {
try {
@ivan-marquez
ivan-marquez / webpack.config.js
Created July 19, 2016 01:54
Webpack config file sample
var path = require('path');
var webpack = require('webpack');
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
module.exports = {
devtool: 'source-map',
debug: true,
entry: {
'app': './src/app/main'
},
@ivan-marquez
ivan-marquez / npm-cheat-sheet.md
Created August 12, 2016 19:12 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@ivan-marquez
ivan-marquez / .jscsrc
Created August 14, 2016 01:32
Jscs config file
{
"excludeFiles": ["node_modules/**", "bower_components/**"],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
@ivan-marquez
ivan-marquez / .jshintrc
Created August 14, 2016 01:33
Js Hint config file
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"esversion": 6,
"forin": true,
"freeze": true,
"immed": true,
@ivan-marquez
ivan-marquez / .bowerrc
Created August 14, 2016 01:40
Bower config file
{
"directory": "public/lib"
}
@ivan-marquez
ivan-marquez / javascript.json
Created April 8, 2017 01:05
Visual Studio Code API Doc snipppets.
/**
* For more info on how to create snippets in VS Code,
* visit https://code.visualstudio.com/Docs/customization/userdefinedsnippets
*/
{
"API Documentation": {
"prefix": "apidocs",
"body": [
"/**",
"* @api {${1:http-method}} ${2:url} ${3:description}",
@ivan-marquez
ivan-marquez / jquery-file-upload.js
Last active June 21, 2017 13:40
JQuery fileUpload attach form values to submit
$('#file').fileupload({
url: 'rewards/postnotes',
singleFileUploads: true,
replaceFileInput: false,
fileInput: $('#file'),
type: 'POST',
autoUpload: false,
progressall: function (e, data) {
button.attr('disabled', 'disabled')
},
@ivan-marquez
ivan-marquez / streams.js
Created March 10, 2018 16:04
Exploring Node.js streams
const fs = require('fs');
const server = require('http').createServer();
server.on('request', (req, res) => {
/**
* We basically put the whole big.file (~400mb) content in memory before we write it
* out to the response object. This is very inefficient.
* memory used: ~430mb
*/
// fs.readFile('./big.file', (err, data) => {