Skip to content

Instantly share code, notes, and snippets.

View ShenTengTu's full-sized avatar
🇹🇼
working & study

涂紳騰(Shen-Teng Tu) ShenTengTu

🇹🇼
working & study
View GitHub Profile
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@anwarishak
anwarishak / model.php
Created April 30, 2012 14:33
Abstract "model" class in a custom PHP MVC framework - also forms the basis of the framework's ORM
<?php
/**
* Abstract class that serves as the Model in the MVC framework.
*
* A Model is a representation of the information in the application. A Model's
* data is saved in the database and the class is used to handle all the
* business logics. This class handles the standard create, read, update
* and delete operations. It must be extended to create the concrete
* implementation of a Model, and handle any other business logics specific to
@s-shin
s-shin / spigot.js
Created August 16, 2012 08:18
Simple Pi calculation library for JavaScript
/**
* spigot.js
* version 1.1.0
* (C) 2012 shin <s2pch.luck at gmail.com>
* Licensed under the Apache License 2.0
* http://opensource.org/licenses/apache2.0
*
* The Pi calculation is based on the spigot (streaming) algorithm[1].
* This library depends on jsbn[2] (jsbn.js and jsbn2.js),
* one of BigInteger library written by pure JavaScript.
@cobyism
cobyism / gh-pages-deploy.md
Last active November 19, 2024 09:32
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@rfreedman
rfreedman / DebouncedOnClickListener.java
Created May 14, 2013 03:09
A debounced onClickListener for Android
import android.os.SystemClock;
import android.view.View;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A Debounced OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately.
@joyrexus
joyrexus / README.md
Last active June 27, 2024 15:39
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

* {
background: #000 !important;
color: #0f0 !important;
outline: solid #f00 1px !important;
}
@nobuoka
nobuoka / commit-built-files-to-gh-pages-branch.markdown
Last active November 22, 2019 15:38
The way to commit built files in subdirectory to gh-pages branch from an arbitrary branch

Committing a subfolder to the gh-pages branch from the other branch

Sometimes you want to commit a subfolder on an arbitrary branch (rather than gh-pages branch) as the root directory to the gh-pages branch. You will want to do so when, for example, the files to be published on GitHub Pages are generated by a build system.

This document shows the way to commit a build/gh-pages directory to the gh-pages branch by using Git plumbing commands. In the following example, Windows PowerShell is used as a shell environment.

Step 1 : Create a tree object

@peterhellberg
peterhellberg / graceful.go
Last active November 13, 2024 20:20
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@keithweaver
keithweaver / bluetooth-raspberry-pi-communication.py
Last active November 14, 2024 11:23
Sending information with bluetooth on Raspberry Pi (Python)
# Uses Bluez for Linux
#
# sudo apt-get install bluez python-bluez
#
# Taken from: https://people.csail.mit.edu/albert/bluez-intro/x232.html
# Taken from: https://people.csail.mit.edu/albert/bluez-intro/c212.html
import bluetooth
def receiveMessages():