Skip to content

Instantly share code, notes, and snippets.

@m-torin
m-torin / tips-for-structured-data-2
Created October 7, 2020 13:57 — forked from the-timallen/tips-for-structured-data-2
Tips for Structured Data on E-commerce sites
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "Organization",
"name": "Distilled",
"url": "https://www.distilled.net/",
"sameAs": [
"http://www.facebook.com/distilled",
@m-torin
m-torin / sqsHelper.js
Created July 9, 2020 20:36 — forked from guikaercher/sqsHelper.js
SQS helper for Node.js
module.exports = (sqs) => {
const createQueue = async (queueName) => {
return await new Promise((resolve, reject) => {
const createQueueParams = {
QueueName: queueName,
Attributes: {
'DelaySeconds': '0',
'MessageRetentionPeriod': '86400'
}
@m-torin
m-torin / aws-ses.js
Created July 9, 2020 20:36 — forked from guikaercher/aws-ses.js
AWS SES endpoints for TEMPLATES
const AWS = require('aws-sdk');
const ses = new AWS.SES({
region: 'us-east-1'
});
const createTemplate = () => {
var params = {
Template: { /* required */
@m-torin
m-torin / PR Template.md
Last active November 6, 2019 15:18
PR Template

Related Issue

TF-XX

This project only accepts pull requests related to Jira issues.
If suggesting a new feature or change, please discuss it in an issue first.
If fixing a bug, there should be an issue describing it with steps to reproduce.

Description

Describe your changes in detail...

@m-torin
m-torin / alphanumeric-lookup.js
Last active November 5, 2017 17:14
Use generateLookup(N) to build your lookup table. Use console.save() to save it, to embed directly in your code (optional). If your needs are small, just grab a pre-built index. https://gist.github.com/kidGodzilla/301bd7b63655f73e16f2f34d09938919
// Build an alphabetic / alphanumeric index lookup
// Scales three characters deep
// Should work for any int up to i = 143,364 when alphabetic (object-safe keys) Math.pow(s.length, 3) + Math.pow(s.length, 2) + s.length
// This can be scaled further by extending s to include digits, characters, etc. (242,234 if alphanumeric)
function generateLookup (length) {
var s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Alphabetic
// var s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // Alphanumeric
var lookup = [];
import React, { Component } from 'react'
import { observer } from 'mobx-react'
import { string, object } from 'prop-types'
// Separate local imports from dependencies
import ExpandableForm from './ExpandableForm'
import './styles/ProfileContainer.css'
// Use decorators if needed
@observer
export default class ProfileContainer extends Component {
<?php
do_action( 'opensky_pre_if_have_posts' );
$prev_month = ''; $prev_year = '';
$paged = ( get_query_var('paged') )? get_query_var('paged') : 1;
query_posts( array( 'post_type'=> 'album', 'paged' => $paged, 'author' => get_current_user_id() ) );
if (have_posts()) :
// Show albums only if the user is a coauthor of at least one
// if(is_coauthor_for_post(get_current_user_id(), get_the_ID())) :
@m-torin
m-torin / gist:1682947
Last active November 5, 2017 17:14
Posts 2 Posts Programmatically Create Association
<?php
// begin front-end posting form
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&$_POST['action'] == "new_creditapp") {
$title =$_POST['title'];
$extracomments = $_POST['extracomments'];
$tags = $_POST['post_tags'];
$legalname = $_POST['legalname'];
@m-torin
m-torin / vindecode-xml.php
Last active November 5, 2017 17:13
xmlparse
<?php
/**
* Cast all the DataOne features SimpleXMLObject into an array
*
* @param SimpleXMLObject $objects
* @return array
*/
function array_cast_features( $data ) {
$return = array();
foreach( $data as $objects ) {
<?php
error_reporting( E_ALL & ~E_NOTICE );
function VAlpha_search( $query ) {
global $wpdb, $custom_fields;
if( is_admin() )
return;
if( ! isset( $_POST['vin'] ) )