Skip to content

Instantly share code, notes, and snippets.

View jwill9999's full-sized avatar
💭
working

Jason Williams jwill9999

💭
working
View GitHub Profile
@jwill9999
jwill9999 / ShowErrors.js
Last active March 6, 2017 23:05
React Redux error Handler
import {PropTypes} from 'react'
import { clearError } from '../../actions'
import { connect } from 'react-redux'
export const ShowErrors = ({errors = [], onClearError = f => f}) =>
<div className = "show-errors" > {(errors.length)
? errors.map((message, i) =>
<div key={i} className="error">
<p>{message}</p>
@jwill9999
jwill9999 / cssLayout.css
Created March 17, 2017 21:15
css layouts
/* How to use em document wide
em sized fonts are based off of the size of the root level font size.
If you change the root font size that cascades document wide
By setting the size to 62.5% we can achieve the 16px default browser
size while making em sizing more understandable (16 * 62.5% = 10)
Now 1.6em = 16px */
body {
font-size: 62.5%;
@jwill9999
jwill9999 / cssLayout.css
Created March 17, 2017 21:15
css layouts
/* How to use em document wide
em sized fonts are based off of the size of the root level font size.
If you change the root font size that cascades document wide
By setting the size to 62.5% we can achieve the 16px default browser
size while making em sizing more understandable (16 * 62.5% = 10)
Now 1.6em = 16px */
body {
font-size: 62.5%;
@jwill9999
jwill9999 / Main.cs
Created March 23, 2017 23:11
c# examples
// Use using to declare namespaces and functions we wish to use
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnimalNS;
/*
Multiline Comment
@jwill9999
jwill9999 / index.txt
Created April 5, 2017 00:18
Entity framework code first set up asp.net mvc5 Entity Framework
Delete mdf file in app-data
Press CTRL-SHIFT-B to build the project.
In Package Manager console type: Enable-Migrations -ContextTypeName MvcMovie.Models.MovieDBContext
Enter and await confirmation
This creates a Configuration.cs file in Migrations folder
Add Seed data to this file.
Press CTRL-SHIFT-B to build the project.
add-migrations +Name
update-database
@jwill9999
jwill9999 / index.txt
Last active April 5, 2017 00:23
MVC5 Entity Framework adding additional properties code first approach
Add prop to Model Class
Build
Update Bindings in Controller class
Update views
Update seed data
Build
add-migration +name
build again
update database
Run as normal
@jwill9999
jwill9999 / index.cs
Created April 5, 2017 00:26
Adding Validation to Asp.net Mvc5 entity framework code first approach
****example******
public class Movie
{
    public int ID { get; set; }
    [StringLength(60, MinimumLength = 3)]
@jwill9999
jwill9999 / Dockerfile
Created May 27, 2017 21:03
docker node
FROM node:7-alpine
RUN mkdir -p /src/app
WORKDIR /src/app
COPY package.json /src/app/package.json
RUN npm install
COPY . /src/app
EXPOSE 3000
CMD [ "npm", "start"]
@jwill9999
jwill9999 / .eslintrc.json
Last active June 22, 2017 18:31
eslint for Reactjs
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react", "import"],
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:import/errors","plugin:import/warnings"],
"parserOptions": {
"ecmaVersion": 6,
@jwill9999
jwill9999 / action.js
Last active June 26, 2017 19:43
action.js
import axios from 'axios';
import {AUTH_USER, UNAUTH_USER, AUTH_ERROR} from './types';
import authError from './error';
const ROOT_URL = 'http://localhost:3000/'; // url to api
export default function signinUser(email,password) {