Skip to content

Instantly share code, notes, and snippets.

@andrewmilson
andrewmilson / file-upload-multipart.go
Last active June 28, 2025 18:41
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@leipert
leipert / detectBrowserLanguage.js
Last active March 11, 2024 02:10 — forked from anonymous/detectBrowserLanguage.js
Detect browser language in javascript (utilizing lodash)
// These window.navigator contain language information
// 1. languages -> Array of preferred languages (eg ["en-US", "zh-CN", "ja-JP"]) Firefox^32, Chrome^32
// 2. language -> Preferred language as String (eg "en-US") Firefox^5, IE^11, Safari,
// Chrome sends Browser UI language
// 3. browserLanguage -> UI Language of IE
// 4. userLanguage -> Language of Windows Regional Options
// 5. systemLanguage -> UI Language of Windows
var browserLanguagePropertyKeys = ['languages', 'language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 6, 2025 08:17
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@aolde
aolde / static_server.js
Last active June 11, 2025 02:42 — forked from ryanflorence/static_server.js
Simple web server in Node.js. This fork added mime types for common file types.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888,
mimeTypes = {
"html": "text/html",
"jpeg": "image/jpeg",
"jpg": "image/jpeg",
"png": "image/png",
@cyokodog
cyokodog / 01_readme.md
Last active July 7, 2020 09:17
シンプルなテーブルフィルター jQuery プラグイン

jQuery Simple Table Filter

シンプルなテーブルフィルター jQuery プラグイン。

##使い方

フィルタ条件の入力フィールド

テキストフィールド、ラジオボタン、プルダウンメニューに対応します。

@hbsnow
hbsnow / CheckBrowser.class.php
Last active November 14, 2016 02:13
PHPでブラウザを振り分けるクラス。振り分けそのものはそこまで厳密なものではなく、IEをのぞくほとんどのブラウザのユーザは常に最新のブラウザを使用していると想定している。
<?php
/**
* ブラウザをゆるく判別
*
* @version 1.2.2
*/
class CheckBrowser
{
@callmephilip
callmephilip / gist:3519403
Created August 29, 2012 21:52
[JavaScript] Dispatching keyboard event
// gecko and webkit
// details here https://developer.mozilla.org/en-US/docs/DOM/event.initKeyEvent
var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";
keyboardEvent[initMethod](
"keydown", // event type : keydown, keyup, keypress
true, // bubbles
@marcedwards
marcedwards / high-dpi-media.css
Last active March 2, 2025 20:24
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 9, 2025 19:05
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname