Skip to content

Instantly share code, notes, and snippets.

View elchingon's full-sized avatar
🐵
coffee-free since Sept' 2023

Alexii Carey elchingon

🐵
coffee-free since Sept' 2023
  • E7 Systems / Ciego Productions
  • Colorado
View GitHub Profile
@elchingon
elchingon / Ubuntu Unicorn RVM Init.d script
Last active August 29, 2015 14:20
Ubuntu Unicorn RVM Init.d script
---- find out the version of ruby and your gemset (because rvm rules)
rvm current
--- create rvm alias
rvm alias create app_name ruby-2.1.2@app_gemset
--- set rvm wrappers (they removed no-link option and seems like all core gems are given a wrapper)
rvm wrapper app_name unicorn_rails
--- /etc/init.d/unicorn
@richardtifelt
richardtifelt / bitly.rb
Created May 15, 2009 12:31
Simple bit.ly API class in Ruby
require 'httparty'
class Api::Bitly
include HTTParty
base_uri 'api.bit.ly'
basic_auth 'username', 'password'
format :json
def self.shorten(url)
response = get('/shorten', :query => required_params.merge(:longUrl => url))
@rtdp
rtdp / gist:742461
Created December 15, 2010 19:27
Importing Gmail Contacts list to Rails Application.
class ImportedContactsController << ApplicationController
require 'net/http'
require 'net/https'
require 'uri'
#THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE.
def authenticate
# initiate authentication w/ gmail
# create url with url-encoded params to initiate connection with contacts api
# next - The URL of the page that Google should redirect the user to after authentication.
# scope - Indicates that the application is requesting a token to access contacts feeds.
@jehiah
jehiah / bitly.rb
Created February 25, 2011 04:46 — forked from richardtifelt/bitly.rb
# Bit.ly API implementation - thanks to Richard Johansso http://gist.github.com/112191
require 'httparty'
class Api::Bitly
include HTTParty
base_uri 'api.bit.ly'
format :json
# Usage: Bitly.shorten("http://example.com")
def self.shorten(url)
@don
don / ArduinoNFC.ino
Last active December 23, 2015 16:59
Arduino sketch for NY Maker Faire 2013 http://makerfaire.com/makers/arduino-nfc/
/*
Seeed Studio (or Adafruit) NFC Shield
Adafruit 60 LED NeoPixel Strip
Arduino Uno
NFC tag should be TNF MIME_MEDIA and Type text/led
Payload should have RGB color as 0,0,255
*/
#if 1
/*
# Usage in html template:
"xxx | nl2br"
<div ng-bind-html=" YourString | nl2br "></div>
or:
@twetzel
twetzel / partial_helper.js.coffee
Created June 21, 2012 04:02
.eco - Partials .. Render Partials in .jst.eco templates (for Rails + Spine / maybe Backbone)
# Render Partials in ECO-Templates like in Rails-ERB
#
# usefull to clean up structure in spine.js and other js-mvc´s like backbone
#
# usage:
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo
#
window.render_partial = ( path, options = {} ) ->
# add the leading underscore (like rails-partials)
# an example Monit configuration file for delayed_job
#
# To use:
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
# 2. replace {app_name} and {environment} as appropriate
# 3. add this to your /etc/monit/monitrc
#
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
check process delayed_job with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid
@rhettallain
rhettallain / raspberrypipicalc.py
Created March 8, 2017 20:49
This is the code to run on raspberry pi for an interactive pi-day poster
#!/usr/bin/python
# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.
import time
import Adafruit_CharLCD as LCD
import Adafruit_CharLCD as LCD
import turtle
import random
from math import sqrt
from gpiozero import Button

Nginx and Puma for Ruby on Rails

When a lot of people are working on the same Rails application, than Vagrant could help to set up environment quick and easy. Even Vagrant is not recommended for production, it is very usefull for testing deployment script. For production we can simply copy deployment script and run manually.

We can deploy Ruby on Rails app using a quick way to deploy ruby on rails on vagrant.