Skip to content

Instantly share code, notes, and snippets.

View jamesoshea's full-sized avatar

James O'Shea jamesoshea

  • Berlin
View GitHub Profile
const payments = [
'Flo paid 15 for train tickets JK',
'Flo paid 53 for dinner JK',
'James paid 9.60 for beers KF',
'Kevin paid 25 for beers JF',
'Flo paid 11.25 for miscellaneous JK',
'Moritz paid 18 for bus tickets JKFSG',
'James paid 76 for food KGSF',
'Simone paid 15 for train tickets MG',
'Simone paid 38.50 for beers KJMG',
class ImaginativeClassName:
description = 'wow'
def instance_method(self):
return self.description
instance = ImaginativeClassName()
instance.instance_method() # 'wow'
class ImaginativeClassName:
description = 'wow'
def instance_method(self):
return self.description
ImaginativeClassName.instance_method() # TypeError: instance_method() missing 1 required positional argument: 'self'
class ImaginativeClassName:
description = 'wow'
def instance_method(self):
return (self.description, self.greeting)
obj = ImaginativeClassName()
obj.greeting = 'mindblowing insight'
obj.instance_method() # ('wow', 'mindblowing insight')
class ImaginativeClassName:
description = 'wow'
@classmethod
def class_method(cls):
return (cls.description, self.greeting)
obj = ImaginativeClassName()
obj.greeting = 'mindblowing insight'
obj.instance_method() # AttributeError: type object 'ImaginativeClassName' has no attribute 'greeting'
const el = document.querySelector("#app");
const spicyObject = {
spicyMethod() {
return 'feel the heat';
}
};
const fullOfPotential = {};
class Question {
constructor() {
this.answer = "No.";
}
answerMe() {
return this.answer;
}
}
const doesJavaScriptHaveClasses = new Question();
@jamesoshea
jamesoshea / acceleration.html
Created April 22, 2018 13:17
Simple device acceleration using Vue
<html>
<head>
<title>Welcome to the danger zone</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
text-align: center;
}
.danger-zone {
background-color: #EE3333;
describe('App.vue', () => {
test('should mount for testing', () => {
expect(1).toEqual(1);
});
});
<template>
<div
class="vte__cool-card"
data-test="cool-card-div"
>
hello I am a card :)
</div>
</template>
<script>