Skip to content

Instantly share code, notes, and snippets.

View superp's full-sized avatar

Pavlo Haleta superp

View GitHub Profile
@galetahub
galetahub / phone_number.rb
Created July 1, 2011 10:16
Phone numbers parser
# PhoneNumber parser
# Example:
# p = PhoneNumber.new('+380971265128')
# => #<PhoneNumber:0xb37b404 @value="380971265128", @locale=:uk, @pattern=[38, "097", ["126", "51", "28"]]>
# p.valid?
# => true
# p.to_s
# => "38 (097) 126-51-28"
# p.to_s(:prefix => true)
# => "+38 (097) 126-51-28"
@superp
superp / gist:1523718
Created December 27, 2011 13:52
Sunrise CRM scaffold template
gem("mysql2")
gem("devise")
gem("sunrise-cms", :path => '/var/www/gems/cms/sunrise')
gem("therubyracer", :group => 'development')
gem("mongrel", :version => "1.2.0.pre2", :group => 'development')
gem("rspec-rails", :version => "~> 2.7.0", :group => 'test')
gem("database_cleaner", :version => "~> 0.7.0", :group => 'test')
gem("factory_girl_rails", :version => "~> 1.4.0", :group => 'test')
gem("fuubar", :group => 'test')
@somebody32
somebody32 / gist:5232120
Last active October 4, 2022 08:19
Список литературы для ознакомления с concurrent programming и реализацией этих принципов и подходов на ruby. Огромное спасибо @brainopia за составление.

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby

@ngpestelos
ngpestelos / remove-docker-containers.md
Last active August 20, 2024 19:34
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@stollcri
stollcri / chrome_HSTS_clear.md
Last active January 4, 2024 05:09
Clear 307 HSTS redirects in Google Chrome

To clear 307 HSTS redirects in Google Chrome (if you experimenting with SSL -- you probably wouldn't want to do this for a site that you do not opperate, since it is there to protect you), go to the following URL and delete the site.

chrome://net-internals/#hsts

@galetahub
galetahub / nginx.conf
Last active May 25, 2024 18:16
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
server {
listen [::]:80;
server_name domain.tld www.domain.tld;
# Redirect all non-https requests
rewrite ^ https://$host$request_uri? permanent;
}
server {
listen [::]:443 ssl http2;
@dlew
dlew / script.sh
Created November 9, 2018 16:36
Simple AndroidX Migration Script
#!/usr/bin/env bash
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very
# well, so I wrote my own script to do the simple job of converting package names.
#
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
#
# It'll run faster on a clean build because then there are fewer files to scan over.
#
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`.