Skip to content

Instantly share code, notes, and snippets.

View ricca509's full-sized avatar

Riccardo Coppola ricca509

View GitHub Profile
@ricca509
ricca509 / contructorInvocation.js
Created November 5, 2012 22:10
Constructor invocation
var Book = function(title) {
this.title = title;
}
// Let's add a method to Book
Book.prototype.getTitle = function() {
return this.title;
}
// Create an instance of Book
@ricca509
ricca509 / prototypalInheritance.js
Created November 6, 2012 09:23
Prototypal inheritance
// Define a new Constructor function
var Coffee = function(type) {
this.type = type;
}
// Add a property to our object
Coffee.prototype.taste = 'sweet';
// Create an instance of Coffee
// This instance inherits all the properties of Coffee
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function World (name) {
@ricca509
ricca509 / chrome-web-security.bat
Last active March 30, 2016 16:08
Chrome: Disable web security [Win]
REM Windows
start chrome --disable-web-security --user-data-dir="C:/temp/chrome_dev"
@ricca509
ricca509 / chrome-web-security.sh
Last active August 10, 2023 08:25
Chrome: Disable web security [OSX]
// OSX
open -na Google\ Chrome --args --disable-web-security --user-data-dir="/tmp/chrome_dev"
import React from 'react';
import Header from './Header';
import Sidebar from './Sidebar';
import Footer from './Footer';
import { Oops } from './Oops'; // Importing a non-default export
export default function HomePage({ data, error }) {
let component = (
<div>
<Header links={data.headerLinks} />
import React from 'react';
import { shallow } from 'enzyme';
import HomePage from '../components/HomePage';
import Header from '../components/Header';
import Sidebar from '../components/Sidebar';
import Footer from '../components/Footer';
import { Oops } from '../components/Oops';
describe('The HomePage component', function () {
describe('when there is no error', function () {
import React from 'react';
import { shallow } from 'enzyme';
import proxyquire from 'proxyquire';
proxyquire.noCallThru();
const Header = () => <div></div>; // stub component
const Sidebar = () => <div></div>; // stub component
const Footer = () => <div></div>; // stub component
const Oops = () => <div></div>; // stub component
// math.js
export function sum(a, b) {
return a + b;
}
export default function sub(a, b) {
return a - b;
}
// main.js
@ricca509
ricca509 / Dockerfile
Last active August 31, 2016 21:17
Containerize Selenium tests
FROM node:6
ADD . /app
WORKDIR /app
RUN npm i