Skip to content

Instantly share code, notes, and snippets.

@azeemh
azeemh / barter.sh
Last active September 12, 2018 01:42
Barter Generator Script (rails 5.2+)
#!/bin/bash
cd
rails new barter --database=postgresql
cd barter
rails db:drop
rails db:create
rails db:migrate
###setup home controller
@przbadu
przbadu / _vue-rails.md
Last active July 16, 2022 21:48
Vue js and Rails integration

Setup Rails and Vuejs

  1. Generate new rails app using --webpack flag
rails new myApp --webpack=vue

Note:

  1. You can use --webpack=angular for angular application and --webpack=react for react.
@azeemh
azeemh / nginx.md
Last active June 29, 2017 19:13
Simple Deployment of App to Proxy with Nginx & Ubuntu 16.04 (Rails, Sinatra, PHP, etc)

This tutorial can be used for any application that runs a server on localhost:port, in this case localhost:3000. i.e. rails s, any sinatra or nodejs server bound to a port, and even php -S localhost:3000...

INSTALL NGINX

purges any old versions

sudo apt-get purge nginx*

install clean nginx

@azeemh
azeemh / nginxproxy.md
Created June 29, 2017 15:26 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@mileandra
mileandra / letsencrypt_setup.md
Last active April 9, 2020 19:39
Letsencrypt on Ubuntu 16.04 with Nginx, Rails and Capistrano-Unicorn-Nginx

Install Letsencrypt

Install with apt-get

$ sudo apt-get update    
$ sudo apt-get install letsencrypt

Generate a strong DH

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Configure nginx

/*!
* jquery oembed plugin
*
* Copyright (c) 2009 Richard Chamorro
* Licensed under the MIT license
*
* Orignal Author: Richard Chamorro
* Forked by Andrew Mee to Provide a slightly diffent kind of embedding experience
*/
(function ($) {
@hilava
hilava / acts_as_votable.md
Last active November 9, 2017 20:30
Acts As Votable (aka Acts As Likeable)

#Acts As Votable (aka Acts As Likeable)

Acts As Votable is a Ruby Gem specifically written for Rails/ActiveRecord models. The main goals of this gem are:

  • Allow any model to be voted on, like/dislike, upvote/downvote, etc.
  • Allow any model to be voted under arbitrary scopes.
  • Allow any model to vote. In other words, votes do not have to come from a user, they can come from any model (such as a Group or Team).
  • Provide an easy to write/read syntax.

##Steps

@soheilhy
soheilhy / nginxproxy.md
Last active October 23, 2024 08:19
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@yangshun
yangshun / youtube-vimeo-url-parser.js
Last active June 14, 2023 22:27
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551