This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Http\Middleware; | |
use Illuminate\Support\Facades\Log; | |
class LogAfterRequest { | |
public function handle($request, \Closure $next) | |
{ | |
return $next($request); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template lang="pug"> | |
.pagination | |
a.pagination__first(:class="{disabled: page == 1}" @click="setPage(1)") | |
a.pagination__prev(:class="{disabled: page == 1}" @click="setPage(page - 1)") | |
a.pagination__page(v-for="p in visiblePages", :class="{active: page == p, disabled: p == '...'}" @click="setPage(p)") {{p}} | |
a.pagination__next(:class="{disabled: page == totalPages}" @click="setPage(page + 1)") | |
a.pagination__last(:class="{disabled: page == totalPages}" @click="setPage(totalPages)") | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 34.173417] usb 1-2: new high-speed USB device number 6 using xhci_hcd | |
[ 53.745299] mt7610u: loading out-of-tree module taints kernel. | |
[ 53.747531] | |
=== pAd = ffffc90001506000, size = 895272 === | |
[ 53.747592] <-- RTMPAllocTxRxRingMemory, Status=0 | |
[ 53.747620] <-- RTMPAllocAdapterBlock, Status=0 | |
[ 53.747702] ==>MT76x0_WLAN_ChipOnOff(): OnOff:1, Reset= 0, pAd->WlanFunCtrl:0x0, Reg-WlanFunCtrl=0xff000002 | |
[ 53.748159] pChipOps->eeread = RTUSBReadEEPROM16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ping 192.168.1.1 | |
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. | |
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.31 ms | |
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.776 ms | |
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.638 ms | |
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.674 ms | |
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.595 ms | |
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=146 ms | |
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=2.25 ms | |
64 bytes from 192.168.1.1: icmp_seq=26 ttl=64 time=156 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RocketCMS.patch 'Page' do | |
model do | |
has_attached_file :icon | |
validates_attachment_content_type :icon, content_type: /\Aimage\/.*\Z/ | |
end | |
edit do | |
field :icon | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NavRenderer < SimpleNavigation::Renderer::List | |
def icon_for(item) | |
(if item.send(:options)[:icon] | |
"<img class='icon' src='#{item.send(:options)[:icon]}' alt=''/> ".html_safe | |
else | |
"" | |
end) + item.name | |
end | |
def tag_for(item) | |
if suppress_link?(item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ------------------------------------------------------------------------------ | |
# SOME INFOS : fairly standard (debian) init script. | |
# Note that node doesn't create a PID file (hence --make-pidfile) | |
# has to be run in the background (hence --background) | |
# and NOT as root (hence --chuid) | |
# | |
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
# INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def thread_state(thr) | |
vars = Hash[thr.thread_variables.map do |k| | |
[k, thr.thread_variable_get(k)] | |
end] | |
{ | |
status: thr.status, | |
stop: thr.stop?, | |
alive: thr.alive?, | |
aoe: thr.abort_on_exception, | |
backtrace: thr.backtrace, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
LOCK = Mutex.new | |
num = Integer(ARGV.shift || 4) | |
processes = Set.new | |
Signal.trap "INT" do |s| | |
$stderr.puts "Shutdown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'msgpack' | |
require 'thread' | |
class ProcessPool | |
def initialize(num_process, args={}) | |
queue_size, worker_class = parse_args([ | |
:queue_size, nil, | |
:worker_class, Worker, | |
], args) |
NewerOlder