This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Since `overlapArea` function is monotonic increasing, we can perform a | |
// simple bisection search to find the distance that leads to an overlap | |
// area within epsilon of the desired overlap. | |
function distanceForOverlapArea(r1, r2, desiredOverlap) { | |
// Ensure r1 <= r2 | |
if (r1 > r2) { | |
var temp = r2; | |
r2 = r1; | |
r1 = temp; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic Dante Socks5 Setup, Debian | |
apt-get update | |
apt-get install make gcc | |
cd /usr/src | |
# get newest from http://www.inet.no/dante/download.html | |
wget http://www.inet.no/dante/files/dante-1.4.1.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vi: | |
devise: | |
confirmations: | |
confirmed: Xác nhận tài khoản thành công! Bạn hiện đang đăng nhập. | |
send_instructions: Bạn sẽ nhận được email hướng dẫn xác nhận tài khoản trong vài phút nữa. | |
send_paranoid_instructions: Nếu email của bạn có trong hệ thống, bạn sẽ nhận được email hướng dẫn xác nhận tài khoản trong một vài phút nữa. | |
failure: | |
already_authenticated: Bạn đã đăng nhập. | |
inactive: Tài khoản của bạn chưa được kích hoạt. | |
invalid: Email hoặc mật khẩu không chính xác. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Put this file in the root of your Rails project, | |
# then run it to output the SQL needed to change all | |
# your tables and columns to the same character set | |
# and collation. | |
# | |
# > ruby character_set_and_collation.rb | |
DATABASE = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (Assuming master is your main branch) | |
# To create a local branch | |
git checkout -b experiment | |
# To push a local branch to remote | |
git push origin experiment | |
# To check out an *existing* remote branch | |
# (In earlier versions, you needed an explicit --track option, but now it's the default when branching off a remote branch) |
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.
NewerOlder