Skip to content

Instantly share code, notes, and snippets.

const crypto = require('crypto');
// Key Generation:
// openssl genrsa -out private.pem 2048
// openssl req -new -x509 -sha256 -key private.pem -out cert.pem
const privateKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAqLBL71MM1yYlJnpMgixaxEPCPn54do6ViE+f0Cn/y+Ym0YyS
gptm+Y2vojsL8djtSXqWsJcjEt3N+3N+64d2wKhL8HOoWyj+EGCU1kG6RODwzgkR
e15KkUq7mxppB2xPVwLGSLAG8o9CKvj3pFFFteMMsXXfWWo9QMGXEmP7+yx2740E
@blakerego
blakerego / karabiner.json
Last active June 12, 2019 20:31
Karabiner config file. Place in .config/karabiner/karabiner.json
{
"global": {
"check_for_updates_on_startup": false,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
Post.transaction do
Post.update_all("last_interacted_at = updated_at")
end
@blakerego
blakerego / ErrorsController.rb
Last active December 16, 2015 10:49
ruby_rails_404_handling
class ErrorsController < ApplicationController
def not_found
end
end
@blakerego
blakerego / gist:5398425
Created April 16, 2013 18:40
ruby-test-should_receive
Pusher.should_receive(:trigger)
@screen = FactoryGirl.create(:tv_screen, :screenable_type => 'Event', :status => 'active', :location_id => @location.id)
@publisher.publish
@blakerego
blakerego / gist:5398394
Created April 16, 2013 18:37
ruby-test-date-range
TvScreen.find(@screen.id).last_aired.should be_within(1.minute).of(DateTime.now)
@blakerego
blakerego / gist:5397449
Created April 16, 2013 16:39
ruby-require-from-root
require "#{Rails.root}/lib/we_tv/screen_generators/post_screen_generator"
class HelloWorldController < AbstractController::Base
include AbstractController::Rendering
include AbstractController::Layouts
include AbstractController::Helpers
include AbstractController::Translation
include AbstractController::AssetPaths
include ActionController::UrlFor
include Rails.application.routes.url_helpers
add_template_helper(ApplicationHelper) #This is important if you want to use your ApplicationHelper methods in your views.
@blakerego
blakerego / gist:5388897
Created April 15, 2013 15:23
haml-simple-form-datetime-bootstrap
= simple_form_for([:admin, @announcement]) do |f|
= f.error_notification
- current_profile = Profile.find_by_user_id(@current_user.id)
.form-inputs
= f.input :message, :required => true
= f.hidden_field :profile_id, :value => @current_user.primary_profile.id
= f.fields_for :TvScreen do |tv|
/// STARTS
= tv.input :starts_on, :placeholder => "MM/DD/YYYY", :input_html => {:class => "datepicker date-picker"}, :label => "Announcement starts on"
@blakerego
blakerego / gist:5377028
Created April 13, 2013 05:12
haml_autocomplete_result
.search_complete
%ul
=# @skill_results.count
-if(@user_results.present? && @user_results.results.count > 0)
.search_section_header#member_search
Members
- @user_results.results.first(5).each do |result|
- if (result.class.to_s == "User")
- result_to_use = result.primary_profile