Skip to content

Instantly share code, notes, and snippets.

View kidchenko's full-sized avatar

Jose Barbosa kidchenko

View GitHub Profile
@kidchenko
kidchenko / 201704121800_CreateAspNetCoreIdentity.cs
Created April 24, 2017 23:10
ASP .NET Identity Core + FluentMigrator
Create.Table("AspNetRoles")
.WithColumn("Id").AsString().PrimaryKey("PK_AspNetRoles").NotNullable()
.WithColumn("ConcurrencyStamp").AsString().Nullable()
.WithColumn("Name").AsString(256).NotNullable()
.WithColumn("NormalizedName").AsString(256).Nullable()
.Indexed("RoleNameIndex");
Create.Table("AspNetUserTokens")
.WithColumn("UserId").AsString().PrimaryKey("PK_AspNetUserTokens").NotNullable()
@kidchenko
kidchenko / 201704121800_CreateAspNetIdentity.cs
Created April 24, 2017 20:36
ASP .NET Identity + Fluent Migrator
[Migration(1)]
public class _201612091350_CreateAspNetIdentity : AutoReversingMigration
{
public override void Up()
{
Create.Table("AspNetRoles")
.WithColumn("Id").AsString().PrimaryKey("PK_AspNetRoles").NotNullable()
.WithColumn("ConcurrencyStamp").AsString().Nullable()
.WithColumn("Name").AsString(256).NotNullable()
.WithColumn("NormalizedName").AsString(256).Nullable()
@kidchenko
kidchenko / scripts.js
Created April 10, 2017 05:05
Remaps for MongoDB
// #geoJson #bot #localization #doordinates
var remap = function(e) {
if (e.LATITUDEGOOGLE) {
e.geoJson = { type: 'Point', name: e['Nome do Estabelecimento'], coordinates: [ e.LONGITUDEGOOGLE, e.LATITUDEGOOGLE ]};
db.estabSus.save(e);
}
}
@kidchenko
kidchenko / gulpfile.js
Last active September 5, 2016 06:57 — forked from Sigmus/gulpfile.js
gulpfile.js with browserify, reactify, watchify and gulp-notify.
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';
@kidchenko
kidchenko / package.json
Created September 5, 2016 00:13
using `npm run` to build and watch with less and browserify
{
"name": "my-app",
"version": "0.0.0",
"dependencies": {
"browserify": "~2.36.1",
"less": "~1.5.1"
},
"devDependencies": {
"watchify": "~0.4.1",
"catw": "~0.2.0"
@kidchenko
kidchenko / json_order.js
Created August 15, 2016 02:41
A small snippet to order a json file
var _ = require('underscore');
var fs = require('fs');
var menu = JSON.parse(fs.readFileSync('file.json', 'utf8'));
menu = _.sortBy(menu, 'nome');
menu = JSON.stringify(menu, null, 4);
fs.writeFile("menu.json", menu);
@kidchenko
kidchenko / npm.cmd
Created July 27, 2016 01:51 — forked from giggio/npm.cmd
Alternative npm.cmd for VS201X node tools integration. Caches npm ls -g result until a different npm command is issued.
@ECHO OFF
SETLOCAL
SET "NODE_EXE=%~dp0\node.exe"
IF NOT EXIST "%NODE_EXE%" (
SET "NODE_EXE=node"
)
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
@kidchenko
kidchenko / cmder.xml
Last active August 29, 2015 14:06
My cmder config
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2015-02-04 16:59:44" build="140707">
<value name="ColorTable00" type="dword" data="00362b00"/>
<value name="ColorTable01" type="dword" data="00423607"/>
<value name="ColorTable02" type="dword" data="00756e58"/>
<value name="ColorTable03" type="dword" data="00837b65"/>
<value name="ColorTable04" type="dword" data="002f32dc"/>
<value name="ColorTable05" type="dword" data="00c4716c"/>
@kidchenko
kidchenko / vim_commands.txt
Last active August 4, 2022 19:12
Vim commands
--------------------
Exit Commands
--------------------
:q Quit (a warning is printed if a modified file has not been saved)
:q! Quit (no warning)
:wq Write file to disk and quit the editor (a warning is printed if a modified other files)
@kidchenko
kidchenko / DecimalModelBinder.cs
Created June 27, 2014 18:14
Make decimal work in asp net mvc
public class DecimalModelBinder : IModelBinder
{
public object BindModel(ControllerContext controllerContext,
ModelBindingContext bindingContext)
{
ValueProviderResult valueResult = bindingContext.ValueProvider
.GetValue(bindingContext.ModelName);
ModelState modelState = new ModelState { Value = valueResult };
object actualValue = null;
try