Skip to content

Instantly share code, notes, and snippets.

View codemariner's full-sized avatar

Scott Sayles codemariner

View GitHub Profile
@codemariner
codemariner / database.ts
Last active January 9, 2025 18:48
spanner databsae wrapper - withTransaction
/* eslint-disable @typescript-eslint/promise-function-async */
import { Buffer } from 'node:buffer'
import type * as sp from '@google-cloud/spanner'
import { type PartialResultStream } from '@google-cloud/spanner/build/src/partial-result-stream.js'
import {
type AsyncRunTransactionCallback,
type RunTransactionOptions,
} from '@google-cloud/spanner/build/src/transaction-runner.js'
import {
type CommitOptions,
export type DbFields<T> = {
[K in keyof T]-?: T[K] | null;
}
export interface OrderFields {
currency?: string;
customerId?: string;
customerName?: string;
creationDate?: Date;
email?: string;
@codemariner
codemariner / foo.js
Created August 16, 2017 15:01
rental view/products
config {
paymentTypes: ['Visa', 'Mastercard']
},
query rentalSelectionView(contentItemId, voucher) {
products: [
{
id: 'sku1',
name: 'HD', //video format
[root@sm-db-2 ~]# ip route show
default via 162.209.50.1 dev eth0
162.209.50.0/24 dev eth0 proto kernel scope link src 162.209.50.79
169.254.0.0/16 dev eth0 scope link metric 1002
[root@sm-db-2 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
@codemariner
codemariner / gist:5312139
Last active December 15, 2015 19:29
JSON results for search overlay
// /aljazeera-vod/search?st=inside
{
"videos":[
{
"date":1357508304000,
"description":"Is the White House trying to buffer and widen its scope of targeted killings with controversial new legislations? Shihab Rattansi speaks to Greg Miller, and Hina Shamsi.",
"url":"/aljazeera-vod/channels/eng/videos/inside-story-americas--are-us-drone-strikes-a-war-crime/2129407026001",
"duration":1513082,
"show":null,
/*
* Login handling module.
*/
define([
"app"
], function(app) {
var Login = app.views.BaseView.extend({
initialize: function() {
@RequestMapping("/_topnav")
public class NavController extends YBTVBaseController {
@RequestMapping("/{cid}")
public String mainNav(Locale locale, Model model, HttpServletRequest pRequest) {
model.addAttribute("channels",null);
model.addAttribute("newsClips", null);
model.addAttribute("topics", null);
model.addAttribute("regions", null);
return "_topnav";
@codemariner
codemariner / gist:5197194
Created March 19, 2013 15:45
search-ahead json response
{
"videos":[
{
"id":2041206623001,
"displayDate":"Dec 17, 2012",
"displayLength":"02:59",
"shortDescription":"See How Video Cloud Moves Business",
"imageUrl":"http://brightcove.vo.llnwd.net/e1/pd/2031051552001/2031051552001_2041222297001_vs-50cf65bde4b002d788037ef2-590065942001.jpg?pubId=2031051552001",
"views":0,
"name":"See How Video Cloud Moves Business",
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
ssayles@talon:pipeline_deals $ git checkout new_deals_page_rebase_companies
Switched to branch 'new_deals_page_rebase_companies'
ssayles@talon:pipeline_deals $ git merge new_deals_page_rebase
Auto-merging app/models/account.rb
Removing app/models/revenue_opportunity.rb
Removing public/javascripts/deal_documents.js
Auto-merging test/factories.rb
Merge made by recursive.
app/controllers/people_controller.rb | 15 +-
app/models/account.rb | 14 +-