Skip to content

Instantly share code, notes, and snippets.

View wisetc's full-sized avatar
😉
missing

Ben wisetc

😉
missing
  • 中国·杭州
View GitHub Profile
@peterhurford
peterhurford / install_xelatex_on_mac.txt
Last active April 16, 2024 04:20
How to install latex and xelatex on Mac so that Jupyter "Download as PDF" will work
brew install pandoc
brew tap homebrew/cask
brew install --cask basictex
eval "$(/usr/libexec/path_helper)"
# Update $PATH to include `/usr/local/texlive/2022basic/bin/universal-darwin`
sudo tlmgr update --self
sudo tlmgr install texliveonfly
sudo tlmgr install xelatex
sudo tlmgr install adjustbox
sudo tlmgr install tcolorbox
@mrspeaker
mrspeaker / org-babel-js-fix.org
Last active November 16, 2022 10:35
"require(...).print is not a function" fix for org-babel:js

Org-babel-js fix

When evaluating this code in an org-mode document:

const sq = x => x * x;
const cube = x => sq(sq(x));
return cube(4);
@markuspoerschke
markuspoerschke / clear_gitlab_runner_cache.sh
Created November 29, 2017 16:41
Clear GitLab Runner cache
docker ps -f status=exited | grep "\-cache-" | awk '{print $1}' | xargs docker rm
@JonathanMH
JonathanMH / index.js
Created October 22, 2016 15:07
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
@GiaoGiaoCat
GiaoGiaoCat / wechat-useragent.js
Created March 6, 2015 03:59
微信内置浏览器UserAgent的判断
// 检测浏览器的 User Agent 应该是非常简单的事情
// 微信在 Android 下的 User Agent
mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352
// 微信在 iPhone 下的 User Agent
mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0
// 通过javascript判断
// 很容易看出来,微信的 User Agent 都有‘micromessenger’字符串标示,我们判断是否含有这些字符串就OK了
function isWeixinBrowser(){
# Snippet setting git branch and git dirty helper
# Commit at the end kept from original snippet, I added the rev-parse stuff and the proper redirection.
set fish_git_dirty_color red
set fish_git_clean_color brown
function parse_git_dirty
if test (git status 2> /dev/null ^&1 | tail -n1) != "nothing to commit (working directory clean)"
echo (set_color $fish_git_dirty_color)
else
@jimmiw
jimmiw / created_at-and-updated_at.sql
Created June 16, 2010 20:45
created_at datetime default now()
# If you need to add a created_at field in your database
# that inserts "now()" when the insert statement is run, you
# can use the following script.
# It uses timestamps, but removes the "on update" for the
# created_at column, but keeps it on the updated_at (which
# needs to update at every change).
#
# got this snippet here:
# http://bugs.mysql.com/bug.php?id=27645
# (search for: "[7 Oct 2009 4:25] Diego Medina")