Skip to content

Instantly share code, notes, and snippets.

View khiav223577's full-sized avatar
🐺
Typing

Rumble Huang khiav223577

🐺
Typing
View GitHub Profile
@amolkhanorkar
amolkhanorkar / PG::Error: ERROR: new encoding (UTF8) is incompatible
Last active November 29, 2023 17:57
Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@jhjguxin
jhjguxin / gpg-tour.md
Created July 19, 2013 08:18
GPG 加密解密简明教程 </br> 作者: riku / 本文采用CC BY-NC-SA 2.5协议 授权

GPG 加密解密简明教程

大家都知道,互联网上充斥着大量的明文传输方式,可以说绝对是不安全地带。那么,我们如何保证在不安全的互联网中更可靠的传输重要数据呢?个人认为最好的方式之一就是使用 GPG 工具进行加密。此文只是简单介绍了 GPG 的常规用法,重在推广和普及 GPG 加密工具,详细的使用请参见 GPG 手册。

名词解释

RSA / DSA / ElGamal : 是指加密算法

GPG :(全称 GnuPG ) 是一款非对称加密(PGP)的免费软件,非对称加密方式简单讲就是指用公钥加密文件,用私钥解密文件。如果你想给谁发送加密信息,首先你要得到他的公钥,然后通过该公钥加密后传给他,对方利用自已的私钥就可解密并读取文件了。

@zhangyuan
zhangyuan / gist:5932220
Last active April 6, 2021 01:53
使用 CarrierWave 和 MiniMagick 合成多张图片、写文字

合成多张图片

以下只适合 v3.5.0 即以前的版本。v3.6.0 以后,对选项增加了 shellescape 减少了命令行注入的风险。

ImageMagick 的 composite 命令可以合成图片,但是一次只能合成两张。如果需要合成多张图片,得用 convert 命令和 -composite 选项。MiniMagick 的push方法,可添加选项和参数(就像在命令行操作一样)。下是一个合成多张图片的 CarrierWave 的 process 示例。

  def composite_images
    manipulate! do |img|
      img.combine_options(:convert) do |c|
@hanksudo
hanksudo / Front-end-Developer-Interview-Questions-TC.md
Last active April 30, 2023 08:12
Front-end-Developer-Interview-Questions - 前端工程師面試問題集(繁體中文版)

前端工程師面試問題集

@版本 2.0.0

譯注:此翻譯版,主要給不能流利的讀英文的人看,相關專有名詞還是保留原文。翻譯不好地方請協助pull request.

此repository包含了一些前端開發的面試問題,來審查一個有潛力的面試者。這並不是建議你對同一個面試者問上所有的問 (那會花費好幾小時)。從列表中挑幾個題目,應該就夠幫助你審查面試者是否擁有你需要的技能。

Rebecca MurpheyBaseline For Front-End Developers 也是一篇很棒且值得讀的文章在你開始面試之前。

@steveclarke
steveclarke / capybara.md
Created April 10, 2012 17:32
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)
@wtaysom
wtaysom / where_is.rb
Created September 23, 2011 08:57
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))