Skip to content

Instantly share code, notes, and snippets.

View alxlion's full-sized avatar
🏗️
Building

Alexandre Lion alxlion

🏗️
Building
View GitHub Profile
@alxlion
alxlion / ips.txt
Created January 29, 2024 09:58
ip_block_weytop
1.12.14.0/23
1.12.32.0/23
1.14.0.0/15
1.44.96.0/24
1.116.0.0/15
1.178.32.0/19
1.247.4.0/24
1.255.30.0/24
2.56.8.0/23
2.56.16.0/22
@alxlion
alxlion / metaprogramming_ruby_ex.rb
Last active August 21, 2020 20:04
Metaprogramming ruby example
# We create a container class. We only store the product's name at instantiation
class Container
attr :product_name
def initialize(name)
@product_name = name
end
end
@alxlion
alxlion / define_method_meta_ex.rb
Created August 21, 2020 20:01
Define_method Metaprogramming example
class Shipment
define_method :cancel do |reason|
@cancelled = true
puts reason
end
end
@alxlion
alxlion / send_meta_ex.rb
Created August 21, 2020 19:59
Send Metapramming Example
s = Shipment.new
if s.respond_to?(:tracking_code)
s.send(:tracking_code, '123ABC') # or s.send('cancel_shipping', '123ABC')
else
puts "Tracking code is not available."
end
@alxlion
alxlion / respond_to_meta_ex_2.rb
Created August 21, 2020 19:57
Respond_to Metaprogramming example 2
s = Shipment.new
if s.respond_to?(:cancel_shipping)
s.cancel_shipping
else
puts "Oh no ! Shipment cannot be cancel."
end
@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
@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 / 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 / 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 / jsx-example1.jsx
Created May 31, 2020 16:47
JSX Example 1
return (
<div>
{students.map(student => <p>{student}</p>)}
</div>
)