This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
// Configure jQuery oEmbed library | |
$.fn.oembed.defaults = { | |
maxWidth: 500, maxHeight: 400, | |
embedMethod: "append" // "replace", "auto", "append", "fill" | |
}; | |
// Append the oEmbed contents fetched from #oembed_url | |
$("form#oembed_form").submit( function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MT Disable Spam Users | |
// @description Display URL and email address and check keywords to delete spam users. | |
// @include http://YOUR-MT-DOMAIN/cgi-bin/mt/mt.cgi* | |
// ==/UserScript== | |
var $; | |
// Add jQuery | |
(function(){ | |
if (typeof unsafeWindow.jQuery == 'undefined') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Types | |
class QueryType < GraphQL::Schema::Object | |
# Add root-level fields here. | |
# They will be entry points for queries on your schema. | |
# queries are represented as fields, use [Types::XXX] for the list | |
field :product, Types::ProductType, | |
null: true, | |
resolve: ->(_obj, args, _ctx) { | |
Product.find(args.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Types | |
# Product schema | |
class ProductType < GraphQL::Schema::Object | |
# Name of this Type | |
graphql_name 'Product' | |
field :sales_history, [Types::SalesHistoryType], | |
null: true, | |
resolve: ->(product, args, ctx) { | |
days = ctx.irep_node.parent.arguments.days || 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Button, Text, View } from 'react-native'; | |
import { RNCamera } from 'react-native-camera'; | |
class ProductScanRNCamera extends Component { | |
constructor(props) { | |
super(props); | |
this.camera = null; | |
this.barcodeCodes = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-------------------+-----------+----------+-------------------------+ | |
| Field name | Type | Mode | Description | | |
+-------------------+-----------+----------+-------------------------+ | |
| id | INTEGER | REQUIRED | Transaction ID | | |
| shop_name | STRING | NULLABLE | | | |
| customers | INTEGER | NULLABLE | Number of customers | | |
| sales | NUMERIC | NULLABLE | Total sales | | |
| tax | NUMERIC | NULLABLE | VAT tax paid | | |
| cost | NUMERIC | NULLABLE | Total costs | | |
| discount | NUMERIC | NULLABLE | Total discount | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
TIMESTAMP_TRUNC(invoiced_at, HOUR) AS timestamp | |
, DATETIME_TRUNC(local_invoiced_at, HOUR) AS date_hour | |
, FORMAT_DATETIME("%A", local_invoiced_at) AS day | |
, MOD(CAST(FORMAT_DATETIME("%u", local_invoiced_at) AS int64), 7) AS day_num | |
, FORMAT_DATETIME("%H", local_invoiced_at) AS hour | |
, shop_name | |
, COUNT(*) AS transactions | |
, SUM(customers) AS customers | |
, SUM(sales) AS sales |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-------------------+-----------+----------+-----------------------------------------+ | |
| Field name | Type | Mode | Description | | |
+-------------------+-----------+----------+-----------------------------------------+ | |
| id | INTEGER | REQUIRED | | | |
| shop_name | STRING | NULLABLE | | | |
| transaction_id | INTEGER | NULLABLE | Transaction which this item belongs | | |
| product_id | INTEGER | NULLABLE | Unique internal product ID | | |
| barcode | STRING | NULLABLE | Universal product ID | | |
| category_code | STRING | NULLABLE | ID of the category | | |
| category_name | STRING | NULLABLE | Name of the category | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const BigQuery = require('@google-cloud/bigquery'); | |
const bigquery = new BigQuery({ YOUR_PROJECT_ID }); | |
const handleError = (err) => { | |
if (err && err.name === 'PartialFailureError') { | |
if (err.errors && err.errors.length > 0) { | |
console.log('Insert errors:'); | |
err.errors.forEach(error => console.error(error)); | |
} | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.SchemaSalesByHour = [ | |
{ | |
description: 'Date and hour of the transactions', | |
name: 'date_hour', | |
type: 'DATETIME', | |
mode: 'REQUIRED' | |
}, | |
{ | |
description: 'UTC timestamp of the transactions', | |
name: 'timestamp', |
OlderNewer