Skip to content

Instantly share code, notes, and snippets.

View KonnorRogers's full-sized avatar

Konnor Rogers KonnorRogers

View GitHub Profile
@joemasilotti
joemasilotti / .rouge-line-focusing.md
Last active June 19, 2024 03:59
Rouge syntax highlighting with line focusing

This gist shows how I'm using Rouge to highlight individual lines of code. On top of the existing syntax highlighting.

I'm using Sitepress which uses markdown-rails under the hood. But this should be applicable to any application rendering markdown with Redcarpet - sub out ApplicationMarkdown as your renderer.

Append @[] when setting the language in a fenced code block to highlight lines of code. Dashes will cover the range, inclusive. Commas will highlight each line.

Examples:

```swift@[4-6]
@leastbad
leastbad / README.md
Last active November 11, 2022 17:27
stimulus-youtube preview

My goal with this was to wrap the terrible YouTube Embed API in a Stimulus controller that would allow me to access the underlying API while providing some convenience methods. One key outcome is that the controller emits youtube events which contain the current position in the video. This means that other code can now respond to the position you are at in the video.

<div data-controller="youtube" data-youtube-code-value="Lo_1pyQ7xvc">
  <button data-action="youtube#play">Play</button>
  <button data-action="youtube#pause">Pause</button>
  <button data-action="youtube#stop">Stop</button>
  <br>
  <div data-youtube-target="frame"></div>
@KonnorRogers
KonnorRogers / geocode_job.rb
Last active April 16, 2022 10:51
async geocoding with Ruby-Geocoder
# app/jobs/geocode_job.rb
class GeocodeJob < ApplicationJob
def perform(model)
model.geocode
end
end
# app/filters/base_filter.rb
class BaseFilter
include ActiveModel::Model
include ActiveModel::Attributes
def initialize(session)
@_session = session
super(@_session.fetch(:filters, {})[filter_resource_class])
end
@chrisjakuta
chrisjakuta / BlogPage.jsx
Last active April 10, 2020 01:03
Blog Detail Page
import React, { useEffect, useState } from 'react'
import { Wave } from 'better-react-spinkit'
// now-ui views
import ProfilePageHeader from '../components/Headers/ProfilePageHeader'
import IndexNavbar from '../components/Navbars/IndexNavbar'
import DarkFooter from '../components/Footers/DarkFooter'
// Reactstrap components
@tpope
tpope / .gitattributes
Created October 24, 2010 20:38
Fewer conflicts in your Rails apps
Gemfile.lock merge=bundlelock
db/schema.rb merge=railsschema