In JavaScript, everything is NOT an object. ECMAScript language types are:
- Undefined
- Boolean
- String
function omit(object, fields) { | |
const shallowObject = Object.assign({}, object); | |
if (typeof fields === Array) { | |
fields.forEach(field => { | |
if (!!shallowObject[field]) delete shallowObject[field]; | |
}); | |
return shallowObject; | |
} else if (typeof fields === "string") return delete shallowObject[fields]; | |
else throw new Error(`fields ${fields} must be array or string`); | |
} |
invoices/123
?
in a URL like /assignments?showGrades=1
.#
portion of the URL. This is not available to servers in request.url
so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.import { useState } from 'react'; | |
export function useCounter(initial = 0) { | |
const [count, setCount] = useState(initial); | |
return [count, () => setCount(count + 1)]; | |
} |
<?php | |
namespace App\Shop\Base; | |
use App\Shop\Base\Interfaces\BaseRepositoryInterface; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\ModelNotFoundException; | |
use Illuminate\Pagination\LengthAwarePaginator; | |
/** |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
<!-- This is the main Blade file that you want your components to show up in --> | |
<!DOCTYPE html> | |
<html lang="{{ config('app.locale') }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Laravel</title> |
This gist was getting a lot of comments/questions, but since there are no notifications when someone replies to a gist, I've moved the setup instructions and a bunch of sample code to a dedicated Github repo.
var express = require('express') | |
, jwtMiddleware = require('express-jwt') | |
, bodyParser = require('body-parser') | |
, cookieParser = require('cookie-parser') | |
, cors = require('cors'); | |
// We pass a secret token into the NodeJS process via an environment variable. | |
// We will use this token to sign cookies and JWTs | |
var SECRET_TOKEN = process.env.SECRET_TOKEN; |
var express = require('express'); | |
var cookieParser = require('cookie-parser'); | |
var session = require('express-session'); | |
var flash = require('express-flash'); | |
var handlebars = require('express-handlebars') | |
var app = express(); | |
var sessionStore = new session.MemoryStore; | |
// View Engines |