Skip to content

Instantly share code, notes, and snippets.

View overtrue's full-sized avatar
🎯
Focusing

安正超 overtrue

🎯
Focusing
View GitHub Profile
@overtrue
overtrue / hang-tag.xml
Last active July 9, 2019 02:20
CloudPrint
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://cloudprint.cainiao.com/print" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://cloudprint.cainiao.com/print http://cloudprint-docs-resource.oss-cn-shanghai.aliyuncs.com/lpml_schema.xsd" xmlns:editor="http://cloudprint.cainiao.com/schema/editor" width="45" height="70" splitable="false">
<layout width="37" height="6" left="4" top="5">
<barcode type="code128" ratioMode="keepRatio">
<![CDATA[<%= _data.item_no %>]]>
</barcode>
</layout>
<layout width="37" left="4" top="13">
<table width="37" style="borderWidth:0;cellBorderWidth:0;">
<tr>
@overtrue
overtrue / .gitconfig
Created February 22, 2019 02:10
git conditional includes
[includeIf "gitdir:~/www/"]
path = .gitconfig-personal
[includeIf "gitdir:~/work/"]
path = .gitconfig-work
// .gitconfig-personal
[user]
email=xxxx@personal.com
@overtrue
overtrue / execute.php
Created July 23, 2018 10:34 — forked from fordnox/execute.php
Execute shell command with timeout and converting stderr to Exception if any
<?php
/**
* @param int $timeout - max process execution time in seconds until it is terminated
**/
function execute($cmd, $stdin = null, $timeout = 600)
{
$this->log->debug("executing: " . $cmd . " ". $stdin);
$cmd = str_replace("\n", "", $cmd);
$cmd = str_replace("\r", "", $cmd);
@overtrue
overtrue / get_scroll_offset.js
Created June 18, 2018 23:43 — forked from yuktse/get_scroll_offset.js
js 获取页面滚动高度
var scrollTop = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| 0;
var scrollLeft = window.pageXOffset // netscape
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| 0;
/*
@overtrue
overtrue / description.sh
Created June 1, 2018 06:13
Fix omf background color
set fish_pager_color_progress cyan
@overtrue
overtrue / Model.php
Last active October 17, 2017 02:48
Model methods
<?php
namespace App\Models;
class Model
{
public static function withoutEvents(Closure $closure)
{
$dispatcher = self::getEventDispatcher();
@overtrue
overtrue / KillWeiboDogs.js
Last active June 3, 2020 03:15
KillWeiboDogs
// 1. 使用 chrome 打开 weibo.com (确保你登录了微博)
// 2. 打开调试窗口,在 console 中贴下面的代码后回车
// 数据来自:https://github.com/yu961549745/WeiboBlackList
let dogs = [ 5471246591, 5209943797, 1709070650, 1887921907, 1824515351, 6031549751, 3477430640, 5303365027, 2397004535, 5014141958, 2357033797, 2253196910, 1282371413, 5433169859, 5577097996, 2477460747, 5791757379, 3973075219, 5480191060, 5064046310, 1794010902, 5241254653, 1775613335, 1749775825, 2898929101, 1766122373, 5330205046, 5836217079, 2143736030, 5088125436, 2122838230, 2379528185, 5768433920, 1588830357, 2734746975, 1702267517, 3305446403, 1922854483, 2240459775, 1713064495, 3141318761, 3049734521, 1297708027, 1670201221, 1113091931, 2682353630, 1889031894, 5736617825, 5573535479, 1787098822, 5474940961, 2647495542, 1978558182, 5675487085, 2066669447, 1410124131, 3318338712, 5117947348, 5984813988, 1935760780, 2106405744, 1658278557, 3123751063, 2418980745, 5612086708, 2822792580, 2728966594, 5651704821, 3174983660, 2884830430, 1409910532, 5289026864, 5460203843, 30409
@overtrue
overtrue / SetLocale.php
Last active August 6, 2017 13:16
常用组件
<?php
namespace App\Http\Middleware;
use App;
use Closure;
use Illuminate\Http\Response;
class SetLocale
{
@overtrue
overtrue / _utils.scss
Last active March 2, 2019 17:16
scss utils.
// Mobile project scss utils.
// https://gist.github.com/overtrue/56561fd4b124b9ffe5048ef06752d4bf
// Space
//
$spacer: 12px !default;
@each $prop, $abbrev in (margin: m, padding: p) {
@for $size from 0 to 10 {
$value: #{$size * $spacer};
@overtrue
overtrue / pkg.youdomain.com.conf
Created February 17, 2017 09:27
Packagist proxy template for nginx vhost.
proxy_cache_path /tmp/nginx/cache keys_zone=one:200m
loader_threshold=300 loader_files=2000;
server {
listen *:80;
client_max_body_size 100M;
server_name pkg.yourdomain.com; # YOUR HOST
charset utf-8;
location / {
proxy_cache one;