Skip to content

Instantly share code, notes, and snippets.

# Login
post "/login" do
@user = User.find_by_username(params[:username])
if @user.password == params[:password]
post to("/user?username=#{@user.username}")
else
redirect to("/login_or_signup?error=#{params[:username]}")
end
end
@matthova
matthova / gist:fceac6fb48de2f88eb3e
Created March 17, 2016 03:16
Posting to Smoothie board with node request library
const request = require(`request`);
// request.post('http://10.139.15.23/command', {form:{data:'G1 X2'}});
const params = {
method: 'POST',
uri: 'http://10.139.15.23/command',
formData: {
data: 'G1 X20',
},
json: true // Automatically stringifies the body to JSON
hovanem$ code .
2016-12-14 14:20:20.127 code[76171:1200712] *** Assertion failure in +[SQRLDirectoryManager currentApplicationManager], /Users/joshaber/Documents/Development/GitHub/Squirrel.Mac/Squirrel/SQRLDirectoryManager.m:30
2016-12-14 14:20:20.133 code[76171:1200712] An uncaught exception was raised
2016-12-14 14:20:20.133 code[76171:1200712] Could not automatically determine the current application's identifier
2016-12-14 14:20:20.133 code[76171:1200712] (
0 CoreFoundation 0x00007fff8bdfd03c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff875d776e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8bdfce1a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff88f9e99b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 Squirrel 0x00000001126f392f __49+[SQRLDirectoryManager currentApplicationManager]_block_invoke + 435
gsed '/\; outer perimeter/,/\;/{//!d}' the_file.gcode > the_file_no_perimeters.gcode
@matthova
matthova / remix-vanilla-extract.tsx
Created May 31, 2021 18:13
Using vanilla-extract with remix
// app/utils/poc.css.ts
import { style } from "@vanilla-extract/css";
export const poc = style({
display: "flex",
});
// app/routes/index.tsx
...
import * as styles from "../utils/mvp.css";