Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env php
<?php
$port = isset($argv[1]) && intval($argv[1]) ? $argv[1] : 8888;
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, '127.0.0.1', $port);
socket_listen($sock);
<div class="links">
<a onclick="doSomething({{ $number }});" href="#">Do something</a>
</div>
<script>
function doSomething(number){
console.log(number);
}
$('.links > a').on({
mouseenter: function () {
$(this).css('color', 'red');
<div class="links">
<a onclick="doSomething({{ $number }});" href="#">Do something</a>
</div>
function doSomething(number){
console.log(number);
}
$('.links > a').on({
mouseenter: function () {
$(this).css('color', 'red');
},
mouseout: function() {
$(this).css('color', '');
}
function doSomething(number){
console.log(number);
}
.links > a:hover {
color: red;
}
<div class="links">
<a data-id='{{ $number }}'>Do something</a>
</div>
$('.links > a').on('click', function(){
console.log($(this).data('id'));
});
<div id="app">
<foo data_id="42" title="Do something"></foo>
</div>
<template>
<div class="links">
<a v-on:click="doSomething">{{title}}</a>
</div>
</template>
<script>
export default {
props: ['data_id', 'title'],
methods: {