Skip to content

Instantly share code, notes, and snippets.

@afilhodaniel
afilhodaniel / gist:09a1df8eafeabe1584c6
Last active November 12, 2020 10:20
Upload photos to Instagram via private API with Ruby
class InstagramPrivateController < ApplicationController
def initialize(username, password, photo, caption)
@username = username
@password = password
@photo = photo
@caption = caption
@cookiepath = Tempfile.new('cookies').path
@user_agent = generate_user_agent()
@xpepper
xpepper / Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq.md
Last active December 13, 2023 01:00
Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq

Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq

The goal: Upload several files (virtually big files) to a Rails application without compromising the user experience.

Architecture

jQuery File Upload + Nginx + Rails (Carrierwave) + Sidekiq

  1. jQuery File Upload (http://blueimp.github.io/jQuery-File-Upload/)
@Adrian2112
Adrian2112 / NavigationBarColor.m
Created November 21, 2013 22:43
UINavigationBar with color
#import "NavigationBarColor.h"
@interface NavigationBarColor ()
@property (nonatomic, strong) CALayer *colorLayer;
@end
@implementation NavigationBarColor
static CGFloat const kDefaultColorLayerOpacity = 0.5f;
static CGFloat const kSpaceToCoverStatusBars = 20.0f;
@stevenhaddox
stevenhaddox / server_certificates_to_pem.md
Last active December 14, 2023 05:42
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

http_path = "/"
http_stylesheets_path = "/stylesheets"
http_images_path = "/images"
http_javascripts_path = "/javascripts"
sass_dir = "sass"
css_dir = "public/stylesheets"
images_dir = "public/images"
javascripts_dir = "public/javascripts"