Skip to content

Instantly share code, notes, and snippets.

View rally25rs's full-sized avatar

Jeff Valore rally25rs

View GitHub Profile
@rally25rs
rally25rs / m503_m122.txt
Created February 6, 2020 11:10
Printer settings dump
Send: M503
Recv: echo: G21 ; Units in mm (mm)
Recv:
Recv: echo:Filament settings: Disabled
Recv: echo: M200 D1.75
Recv: echo: M200 D0
Recv: echo:Steps per unit:
Recv: echo: M92 X93.00 Y93.00 Z137.00 E104.00
Recv: echo:Maximum feedrates (units/s):
Recv: echo: M203 X300.00 Y300.00 Z5.00 E25.00
@rally25rs
rally25rs / data.json
Created April 29, 2019 17:53
search sample data
[
"V004D000000007826042019160212558 Asap ABC Sales Sales 33019 1556312412 1 NORMAL Platform Toolkit API",
"V004E000000007926042019160212584 Asap ABC Sales Sales 33019 1556312472 1 NORMAL Platform Toolkit API",
"V004F000000008026042019160212609 Asap ABC Sales Sales 33019 1556312532 1 NORMAL Platform Toolkit API",
"V0050000000008126042019160212634 Asap ABC Sales Sales 33019 1556312532 1 NORMAL Platform Toolkit API",
"V0051000000008226042019160212659 Asap ABC Sales Sales 33019 1556312592 1 NORMAL Platform Toolkit API",
"V0052000000008326042019160212685 Asap ABC Sales Sales 33019 1556312652 1 NORMAL Platform Toolkit API",
"V0053000000008426042019160212711 Asap ABC Sales Sales 33019 1556312712 1 NORMAL Platform Toolkit API",
"V0054000000008526042019160212737 Asap ABC Sales Sales 33019 1556312712 1 NORMAL Platform Toolkit API",
"V0055000000008626042019160212761 Asap ABC Sales Sales 33019 1556312772 1 NORMAL Platform Toolkit API",
@rally25rs
rally25rs / nginx_rails_sendfile.md
Last active July 7, 2023 09:17
nginx rails send_file madness

Goal: Have some static content, served by Nginx, but it requires an authenticated user. User auth is through Rails.

Project structure: The actual static files are in /home/vagrant/docs/ The browser will use the URL /help/* to access this content

The Ruby bits: RAILS_ENV=production rails server is used to start a WEBrick on port 3000.

config/environments/production.rb

@rally25rs
rally25rs / fileStorage.coffee
Created December 29, 2014 14:22
Cordova File API Wrapper
window.fileStorage =
save: (name, data) ->
deferred = $.Deferred()
fail = (error) =>
deferred.reject(error)
gotFileSystem = (fileSystem) =>
fileSystem.root.getFile(name, { create: true, exclusive: false }, gotFileEntry, fail)
@rally25rs
rally25rs / gist:cb58c6aa57a04d777efb
Created September 23, 2014 18:46
SQL Server - Get all running queries
SELECT SUBSTRING(st.text, ( r.statement_start_offset / 2 ) + 1,
( ( CASE WHEN r.statement_end_offset <= 0
THEN DATALENGTH(st.text)
ELSE r.statement_end_offset END -
r.statement_start_offset ) / 2 ) + 1) AS statement_text ,
r.session_id,
r.status,
r.command,
r.cpu_time,
r.total_elapsed_time
@rally25rs
rally25rs / kendo.binders.class.js
Created August 4, 2014 12:03
Class MVVM binder for Kendo UI
kendo.data.binders.class = kendo.data.Binder.extend({
init: function (target, bindings, options) {
kendo.data.Binder.fn.init.call(this, target, bindings, options);
// get list of class names from our complex binding path object
this._lookups = [];
for (var key in this.bindings.class.path) {
this._lookups.push({
key: key,
path: this.bindings.class.path[key]
@rally25rs
rally25rs / .gitignore
Created August 9, 2012 11:58
.gitignore for .NET projects.
# .gitignore for .NET projects
# Standard VS.NET
obj
bin
*.csproj.user
*.suo
*.cache
Thumbs.db
@rally25rs
rally25rs / JsonEncodeAnExpandoObjectByWrappingItInADynamicJsonObject.cs
Created July 3, 2012 20:09
Serialize an ExpandoObject to a JSON string by wrapping it in a DynamicJsonObject
// By default, Json.Encode will turn an ExpandoObject into an array of items,
// because internally an ExpandoObject extends IEnumerable<KeyValuePair<string, object>>.
// You can turn it into a non-list JSON string by first wrapping it in a DynamicJsonObject.
[TestMethod]
public void JsonEncodeAnExpandoObjectByWrappingItInADynamicJsonObject()
{
dynamic expando = new ExpandoObject();
expando.Value = 10;
expando.Product = "Apples";
@rally25rs
rally25rs / AnythingToCs.cs
Created April 5, 2012 11:56
Anything to CSV
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace AnythingToCsv
{
public static class EnumerableExtensions
{
@rally25rs
rally25rs / MvcMockHelpers.cs
Created January 8, 2012 15:26
MvcMockHelpers.cs - Helper Utility for Mocking MVC3 Controllers with Moq.
using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Moq;
/// <summary>
/// This helper class can be used to set up Moq mocks of MVC3 controllers.
/// Slightly modified from the original version from Scott Hanselman's blog: