Skip to content

Instantly share code, notes, and snippets.

@ro31337
ro31337 / gist:fde256c19074356e4f847a48f696658c
Last active Apr 8, 2021
Bulma font-awesome icons for Rails 6
View gist:fde256c19074356e4f847a48f696658c

Единственная запара возникла при подключении иконок к рельс6, решается так (app/javascript/packs/fa.scss)

@import "bulma/bulma";

$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/solid'; // fas prefix
@import '~@fortawesome/fontawesome-free/scss/brands'; // fab prefix
// see https://fontawesome.com/how-to-use/with-the-api/setup/importing-icons for more prefixes
@abohannon
abohannon / PrivateRoute.js
Created Dec 22, 2017
React/Redux Auth with Private Route Component
View PrivateRoute.js
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
const PrivateRoute = ({ component: Component, authed, ...rest }) => (
<Route
{...rest}
render={props => (
authed
? <Component {...props} />
: <Redirect to="/login" />
@tterb
tterb / README-badges.md
Last active Sep 16, 2021
A collection of README badges
View README-badges.md

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@mrbar42
mrbar42 / README.md
Last active Sep 16, 2021
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)
View README.md

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
      |- 360p.m3u8
@jonyardley
jonyardley / Dockerfile
Last active May 30, 2021
Precompile Ruby on Rails assets with Docker
View Dockerfile
ARG ASSET_HOST
RUN bundle exec rake ASSET_HOST=${ASSET_HOST} RAILS_ENV=production assets:precompile
@mtchavez
mtchavez / disk-check.json
Last active Sep 27, 2020
Consul Nagios Example Checks
View disk-check.json
{
"check": {
"id": "check-disk",
"name": "check-disk",
"script": "/usr/lib/nagios/plugins/check_disk -w 30% -c 5%",
"interval": "1m"
}
}
View gist:b206d09c587e8fc6399e

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@yuki24
yuki24 / .gitignore
Last active Jul 20, 2020
jbuilder vs ActiveModel::Serializers
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@kylemcdonald
kylemcdonald / post-server.py
Created Sep 21, 2014
Python POST simple server
View post-server.py
import SimpleHTTPServer
import SocketServer
PORT = 8000
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
post_body = self.rfile.read(content_len)