Skip to content

Instantly share code, notes, and snippets.

View Mucaccino's full-sized avatar
🌐
Open to work

Murillo L do Carmo Mucaccino

🌐
Open to work
View GitHub Profile
@Mucaccino
Mucaccino / image-arraybuffer.js
Created January 11, 2019 20:59 — forked from candycode/image-arraybuffer.js
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@Mucaccino
Mucaccino / Readme.md
Created December 19, 2018 16:55
Vue CLI 3 + Bootstrap

Install

npm i bootstrap jquery popper.js

Add to src/main.js:

import 'bootstrap'; import 'bootstrap/dist/css/bootstrap.min.css';

@Mucaccino
Mucaccino / nodepath.js
Created June 20, 2018 19:35 — forked from lepture/nodepath.js
check NODE_PATH
if (!process.env.NODE_PATH) {
console.log();
if (process.env.SHELL === '/bin/zsh') {
console.log(' Please set environment variable NODE_PATH in ~/.zshrc:');
} else if (process.env.SHELL === '/bin/bash') {
console.log(' Please set environment variable NODE_PATH in ~/.bashrc:');
} else {
console.log(' Please set environment variable NODE_PATH:');
}
console.log();
@Mucaccino
Mucaccino / info.js
Created May 30, 2018 19:41
Nuxt.js > Axios Module Pattern
You can provide the instance of axios through a plugin:
// resources.js
export const $axios;
export const User = {
findById: function (id) {
...
$axios.get(...)
}
@Mucaccino
Mucaccino / npm.md
Created May 15, 2018 17:16 — forked from 0bie/npm.md
npm beginner notes

npm commands

  • Update npm: npm install npm --global || npm i npm -g
  • New package: npm init --yes || npm init -y
  • Scopes: npm init --scope=myusername npm install @myusername/mypackage require('@myusername/mypackage')
  • Add dependencies: npm install --save package-name || npm i -s package-name
  • Add devDependencies: npm install --save-dev package-name || npm i -D package-name
  • Skip devDependencies: npm install --production
  • Add bundled dependencies: npm install --save --save-bundle package-name
  • Update dependencies: npm outdated && npm update
Remove all PNG files from repository but keep the working copies:
git rm --cached **/*.png
Add them again
git add **/*.png
Ready to commit!
@Mucaccino
Mucaccino / Entry.cs
Created February 25, 2017 05:53 — forked from csharpforevermore/Entry.cs
An example model class for Entity Framework using code first
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace Website.Models.EntityFrameworkCodeFirst
{
public class Entry
{
[Key]
@Mucaccino
Mucaccino / EF_Migration.cs
Created February 24, 2017 23:53
Entity Framework Migrations
/* Usage in Package Manager Console:
Enable-Migrations
Add-Migration "SetupMigrations"
Update-Database
-- change model
Add-Migration "AddedPersonField"
Update-Database
Rollback to specific:
Update-Database -TargetMigration:"SetupMigrations"
@Mucaccino
Mucaccino / BusinessLogic.cs
Created February 24, 2017 23:53 — forked from Jawvig/BusinessLogic.cs
Entity Framework tightened dependencies
public class Coordinator
{
private readonly ICompleteUnitOfWork _unitOfWorkCompleter;
private readonly WidgetGenerator _widgetGenerator;
private readonly WotsitGenerator _wotsitGenerator;
public Coordinator(
ICompleteUnitOfWork unitOfWorkCompleter,
WidgetGenerator widgetGenerator,
WotsitGenerator wotsitGenerator)
@Mucaccino
Mucaccino / TablePerConcreteEFB9.cs
Created February 24, 2017 23:20 — forked from b9chris/TablePerConcreteEFB9.cs
Entity Framework - Class-based Table-per-Concrete-Class (TPC) attributes and extender
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.ModelConfiguration.Configuration;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Brass9.Collections.HasProp;