Skip to content

Instantly share code, notes, and snippets.

View jinhucheung's full-sized avatar
🏗️
Building

jim jinhucheung

🏗️
Building
View GitHub Profile
@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
require 'warden/github'
class SidekiqGithubChecker
def self.registered(app)
app.helpers do
def warden; env['warden'] end
def github_organization_authenticate!(name)
unless warden.user.organization_member?(name)
halt [401, {}, ["You don't have access to organization #{name}"]]
end
@jonsuh
jonsuh / .bash_profile
Last active February 16, 2024 17:17
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@parmentf
parmentf / GitCommitEmoji.md
Last active June 11, 2024 20:06
Git Commit message Emoji
-----BEGIN CERTIFICATE-----
MIIDmDCCAoCgAwIBAgIEaXZGFjANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJVUzEZMBcGA1UE
CxMQVXNlcm5hbWU6IGJndWVyeTFKMEgGA1UEAwxBXyBETyBOT1QgSU5TVEFMTCB1bmxlc3MgdGhp
cyBpcyB5b3VyIGNlcnRpZmljYXRlIChKTWV0ZXIgcm9vdCBDQSkwHhcNMTUwNjA5MDk0MjM2WhcN
MTUwNjE2MDk0MjM2WjB0MQswCQYDVQQGEwJVUzEZMBcGA1UECxMQVXNlcm5hbWU6IGJndWVyeTFK
MEgGA1UEAwxBXyBETyBOT1QgSU5TVEFMTCB1bmxlc3MgdGhpcyBpcyB5b3VyIGNlcnRpZmljYXRl
IChKTWV0ZXIgcm9vdCBDQSkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC01TE6fnQP
VQtoHyI85tVe5YQzxBsS0ZKwRNr7bWGplku1GOZoSGuR8sgnqiK7vrWk7io6ESbiB8X4EXBSsABR
rkhrwSZINIdAoJ4+ZZVCTDTpxKFXbLbXZze8+xP8PD78HDEr4HxXcbBCAM0W5IwnyfdPMhJQ2ZcF
sE2PfJDHwJ5RJDPXHljZUDhDyu4ZGp5fEt0o6CuDfpOsStcPGiGhcKiXv3vFUN9gEKMATPGLUd8N
@tomas-stefano
tomas-stefano / Readme.md
Last active January 18, 2023 13:56
Pre commit ruby script

Pre-commit hook

This is a pre-commit script that will see the git diff and run the appropriate checks like JSHint and Rubocop

You can add to your .git/hooks of any repo that you like.

Notes

  1. Don't forget to add the executable permission to this file and have the following installed:
@quexer
quexer / jQuery-plugin-authoring.md
Created September 4, 2012 09:42
如何编写 jQuery 插件

创建插件


看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。

开始

require 'matrix'
def regression x, y, degree
x_data = x.map {|xi| (0..degree).map{|pow| (xi**pow) }}
mx = Matrix[*x_data]
my = Matrix.column_vector y
((mx.t * mx).inv * mx.t * my).transpose.to_a[0].reverse
end