Skip to content

Instantly share code, notes, and snippets.

View rxgx's full-sized avatar

Ryan Gasparini rxgx

View GitHub Profile
@rxgx
rxgx / iptables.up.rules
Created May 19, 2010 23:49
Firewall template for Rails Rackspace Instance
*filter
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
@rxgx
rxgx / Reset Table IDs.sql
Created June 26, 2010 01:05
Reset table IDs and AUTO_INCREMENT
ALTER TABLE `users` DROP `id`;
ALTER TABLE `users` AUTO_INCREMENT = 1;
ALTER TABLE `users` ADD `id` int UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
@rxgx
rxgx / webkit-scrollbar.css
Last active October 30, 2015 16:25
scrollbar styles taken from the Chrome store
::-webkit-scrollbar,
::-webkit-scrollbar-thumb {
overflow: visible;
border-radius: 0;
border: solid 1px #A6A6A6;
}
::-webkit-scrollbar {
width: 10px;
border-right: 0;
@rxgx
rxgx / code-server.md
Last active October 10, 2019 11:16
Code Server Security Checklist for Ubuntu 18 LTS

Code Server Checklist

Use these steps to lock down your cloud instance of code server by only allowing whitelisted users to have SSH access and limit Safari to only HTTPS traffic.

Login as Root

@rxgx
rxgx / example.css
Created October 9, 2012 22:29
CSS Property Order Convention
css-property-order {
/* Position Values */
top: 0;
right: 0;
bottom: 0;
left: 0;
/* Box Sizing */
width: auto;
@rxgx
rxgx / coords.txt
Created December 30, 2013 10:52
Legacy Offset & Positioning of Two Elements
x ----
| |
| |
| |
y ---- ---- a
| |
---- b
a > x
a = y
@rxgx
rxgx / helper.rb
Last active January 2, 2016 12:59
Embed JSON on page with ActiveModel::Serializer
module ApplicationHelper
def json_for(target, options = {})
options[:scope] ||= self
options[:url_options] ||= url_options
target.active_model_serializer.new(target, options).to_json
end
end
@rxgx
rxgx / osx.md
Last active May 19, 2021 18:34
Mac OS Install Checklist

Here's what to do after completing a fresh install of Mac OS X.

General Config

  1. App Store

    • Run Software Update
    • Install software
  2. Keyboard

@rxgx
rxgx / gist:b24b43fa8ec436e3d6e3
Last active June 9, 2020 23:34
Render a React Component with Angular Router

For coupling new ReactJS components with legacy angular routing/services.

  • Create a function that returns the angular route object. This object contains a controller that handles the mounting and unmounting of the React component, as well as a container template to render the component inside of. Note: the containerId is arbitrary and only exists to identify the container the component will be placed in.
var registerRouteForComponent = function (componentClass) {
    var containerId = 'reactComponentRender';

    var controller = function ($scope, $injector) {
@rxgx
rxgx / Dockerfile
Last active November 12, 2019 17:49
NodeJS Docker & Make Files
FROM node:lts
# Copy the working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm ci --no-progress
RUN npm run build --if-exists
# Exposes a port to other containers but your app may use any port specified in it