Skip to content

Instantly share code, notes, and snippets.

View bladebhs's full-sized avatar

Vladislav Isakov bladebhs

  • Nizhny Tagil, Russia
View GitHub Profile
@satendra02
satendra02 / app.DockerFile
Last active March 3, 2024 10:13
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@j-jith
j-jith / custom-rom-redmi2.rst
Created October 28, 2017 05:09
Installing a custom ROM on Xiaomi Redmi 2

Installing a custom ROM on Xiaomi Redmi 2

Before proceeding, make sure you have backed up all your important data to another device.

Custom Recovery

Most custom ROMs require a custom recovery. In this section, I will provide the

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@prog1dev
prog1dev / gist:62660be194ce4aec73721a0af1665983
Last active April 29, 2020 12:48
download_zip method without temp files
def download_zip(image_list)
unless image_list.blank?
file_name = 'pictures.zip'
stringio = Zip::ZipOutputStream::write_buffer do |z|
image_list.each do |img|
title = img.title
title += '.jpg' unless title.end_with?('.jpg')
z.put_next_entry(title)
@gilyes
gilyes / Backup, restore postgres in docker container
Last active June 11, 2024 21:21
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@thejbsmith
thejbsmith / Rails Singleton Model
Last active April 16, 2024 00:29
Rails Singleton Model
Rails Singleton Model
Taken from:
http://stackoverflow.com/questions/399447/how-to-implement-a-singleton-model/12463209#12463209
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@rkjha
rkjha / nginx-passenger-ssl.conf
Last active March 25, 2021 15:47
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
@rxaviers
rxaviers / gist:7360908
Last active June 17, 2024 04:46
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: