Skip to content

Instantly share code, notes, and snippets.

View alxlion's full-sized avatar
🏗️
Building

Alexandre Lion alxlion

🏗️
Building
View GitHub Profile
@Scope("singleton")
public class InternalDatabase {
private List<Transaction> memory;
public InternalDatabase() {
if (this.memory == null) {
this.memory = new ArrayList<>();
}
}
@alxlion
alxlion / gist:2881c29649bc5d477954f79b3071e408
Last active March 11, 2019 15:00
Figure component Hugo/NetlifyCMS
CMS.registerEditorComponent({
// Internal id of the component
id: "figure",
// Visible label
label: "Figure",
// Fields the user need to fill out when adding an instance of the component
fields: [
{name: 'src', label: 'Image', widget: 'image'},
{name: 'caption', label: 'Caption', widget: 'string'},
{name: 'link', label: 'Link', widget: 'string'},
@alxlion
alxlion / vue-component-example1.vue
Created May 31, 2020 16:34
Vue Component Example 1
<template>
<div id="myComponent">
<Counter />
<span v-if="reading">Hello reader !</span>
</div>
</template>
<script>
import Counter from "@/components/Counter";
@alxlion
alxlion / react-es6-class-example1.jsx
Created May 31, 2020 16:45
React ES6 Class Example 1
class MyComponent extends React.Component {
render() {
return(<div />)
}
}
@alxlion
alxlion / vue-component-example1.js
Created May 31, 2020 16:46
Vue Component Example 1
Vue.component({
template: `<div></div>`
})
@alxlion
alxlion / jsx-example1.jsx
Created May 31, 2020 16:47
JSX Example 1
return (
<div>
{students.map(student => <p>{student}</p>)}
</div>
)
@alxlion
alxlion / vue-template-example-1.vue
Created May 31, 2020 16:47
Vue template example 1
<div>
<p v-for="student in students">{{ student }}</p>
</div>
@alxlion
alxlion / class-react-example-1.jsx
Created May 31, 2020 16:48
Class example react 1
class MyComponent extends React.Component {
constructor(props) {
super(props)
this.state = {
counter: 0
}
}
render() {
return(<div/>)
@alxlion
alxlion / hook-react-example-1.jsx
Last active May 31, 2020 16:55
Hook react example 1
function MyComponent() {
const [counter, setCounter] = useState(0)
return(<div />)
}
@alxlion
alxlion / respond-to-metaprog-ex-1.rb
Last active August 21, 2020 19:52
Respond_to Metaprogramming example
class Shipment
def prepare_for_delivery
@message = 'Shipment is prepared for delivery'
end
def tracking_code(code)
@tracking_code = code
end