Skip to content

Instantly share code, notes, and snippets.

Ben Koshy BKSpurgeon

  • Melbourne, Australia
Block or report user

Report or block BKSpurgeon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BKSpurgeon
BKSpurgeon / elm-json-flags.md
Created Nov 6, 2019
Elm - Hello World - Passing Json Flags
View elm-json-flags.md
  • An Example of passing a Json string as a flag to elm, in a rails application.
  • I'm learning ELM, so likely, this code example is far from ideal.
  • Using Webpacker to make it all work!

Here is my Main.elm file

module Main exposing (..)

import Browser
@BKSpurgeon
BKSpurgeon / printing_links.md
Created Oct 22, 2019
Printing links in a prawn pdf table
View printing_links.md
@BKSpurgeon
BKSpurgeon / XDataWriterInterface.md
Created Oct 16, 2019
The Interface for Writing Data to the Line
View XDataWriterInterface.md
namespace DialogTest
{
    public interface XDataWriter
    {
        void WriteXDataToLine(string profile, double rotation);
    }
}
View ransack-post-form-pagy-1.md

How to paginate search results when POSTing a complex form

I am using Rails. But the concepts can be easily applied to whatever framework you are using though. Please change the class names/helpers that you use, according to your particular case.

1. Add Hidden Field to your form

  • Firstly: add a hidden field in your form as follows:
  • Note very closely the class that we are adding to the hidden field. This is very important because we will be using this class in our jquery event handler.
@BKSpurgeon
BKSpurgeon / redo_form.md
Last active Oct 13, 2019
Quote App - Redo Forms
View redo_form.md

The task at hand: Instructions

  • To make a form look better. This is how it looks right now.
  • Please keep all the admin items together.
  • You do not need to change the stylesheet, simply use bootstrap and your creativity to present the form better to the end user.

Here is the form as it now stands. The layout needs improvement:

General Notes:

@BKSpurgeon
BKSpurgeon / SteelBeamsDataSource.md
Created Sep 3, 2019
Specifying Requirements for Beam DataSource
View SteelBeamsDataSource.md
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Data;

namespace SteelBeams
View stack_overflow_answer-could not catch exception.md
class ApplicationController < ActionController::Base

  before_action :raise_error
  rescue_from ActionController::UnknownFormat, :with => :render_standard_error
  
  private
  def render_standard_error
    puts "*" * 25
    puts "it is rescuing!"
@BKSpurgeon
BKSpurgeon / stack_overflow_question-1.md
Last active Aug 18, 2019
Car Fleet or Train Fleet?
View stack_overflow_question-1.md
@BKSpurgeon
BKSpurgeon / autocad-dot-order-IntersectionPoints-partII.md
Last active May 9, 2019
Print Staggered and Offset Intersection Lines (AutoCAD .net API)
View autocad-dot-order-IntersectionPoints-partII.md

Client Code

Refer here for Part 1: because only the relevant and necessary code is pasted here:

        [CommandMethod("GetIntersectionPoints", CommandFlags.UsePickSet)]
        public static void IntersectionPoints()
        {
            try
@BKSpurgeon
BKSpurgeon / autocad-dot-order-IntersectionPoints.md
Last active May 9, 2019
Get and Ordered List of Intersection Points
View autocad-dot-order-IntersectionPoints.md

The following allows us to get an ordered list of intersection points, along a particular direction:

The Client

 [CommandMethod("GetIntersectionPoints", CommandFlags.UsePickSet)]
        public static void IntersectionPoints()
        {
            try
            {
                Document doc = Application.DocumentManager.MdiActiveDocument;
You can’t perform that action at this time.