Skip to content

Instantly share code, notes, and snippets.

View PelagicDev's full-sized avatar

Jordan Godwin PelagicDev

  • CompanyCam
  • Wilmington, NC
  • 17:34 (UTC -04:00)
  • X @PelagicDev
View GitHub Profile
@dhh
dhh / comments_channel.rb
Last active December 16, 2020 14:24
On-boarding a specialized broadcast method in the channel itself
# Channel
class CommentsChannel < ApplicationCable::Channel
def self.broadcast_comment(comment)
broadcast_to comment.message, comment: CommentsController.render(
partial: 'comments/comment', locals: { comment: comment }
)
end
def follow(data)
stop_all_streams
@willprice
willprice / README-opencv-3.1-raspberry-pi-installation.md
Last active May 14, 2021 08:24
How to install OpenCV 3.1 on Raspbian Jessie (Lite)

Installing OpenCV 3.1 on Raspbian Jessie

Prerequisites

  • Keep your system up to date:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade
    • $ sudo reboot
  • Make sure you've got an internet connection.
  • Make sure you've got
  • wget
@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 15, 2024 16:01
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@mlanett
mlanett / rails http status codes
Last active June 14, 2024 06:07
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@romanlv
romanlv / gist:91195b41087ba2d94eee
Last active February 7, 2019 10:47 — forked from aht/gist:5097702
ansible postgres playbook with PostGIS 2.1 on Ubuntu 14.04, setting up postgis_template and creating databases from this postgis_template
---
# packages.yml
- name: Add postgres repository
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ {{ansible_distribution_release}}-pgdg main' state=present
- name: Add postgres repository key
apt_key: url=http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc state=present
@dmilisic
dmilisic / active_record_enum_with_rails_admin.rb
Last active January 21, 2022 10:50
Initializer for handling ActiveRecord (4.1+) enums by RailsAdmin (0.6.2)
module ActiveRecord
module RailsAdminEnum
def enum(definitions)
super
definitions.each do |name, values|
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a }
define_method("#{ name }=") do |value|
if value.kind_of?(String) and value.to_i.to_s == value
@Agowan
Agowan / album_form.rb
Last active April 5, 2016 20:50
A simple way to use has_many between form objects using Virtus.The problem I had was to get validations working with fields_for in the view, but still have the flexibility and full control using virtus instead of active record models.And I added a way of checking for sanitised args in rails 4.
# encoding: utf-8
class AlbumForm < BaseForm
has_many :songs, class_name: 'SongForm'
validates :songs, form_collection: true
end
@jeffjohnson9046
jeffjohnson9046 / ruby-ldap-sample.rb
Last active January 5, 2024 07:11
Some VERY basic LDAP interaction in Ruby using Net::LDAP.
#######################################################################################################################
# This Gist is some crib notes/tests/practice/whatever for talking to Active Directory via LDAP. The (surprisingly
# helpful) documentation for Net::LDAP can be found here: http://net-ldap.rubyforge.org/Net/LDAP.html
#######################################################################################################################
require 'rubygems'
require 'net/ldap'
#######################################################################################################################
# HELPER/UTILITY METHOD
@sarukuku
sarukuku / dabblet.css
Created April 21, 2012 17:57
Image with an on hover fade in-out caption.
/**
* Image with an on hover fade in-out caption.
*/
@import url(http://fonts.googleapis.com/css?family=Oswald);
/**
* Natural box-model
*/
@michaek
michaek / .bash_aliases
Last active December 3, 2015 07:05
Bash Aliases
# here
alias vba='vim ~/.bash_aliases'
alias mba='mate ~/.bash_aliases'
alias sba='subl ~/.bash_aliases'
alias ba='source ~/.bash_aliases'
# profile
alias sbp='subl ~/.bash_profile'
alias bp='source ~/.bash_profile'
# bundle
alias bu='bundle'