Skip to content

Instantly share code, notes, and snippets.

@odesey
odesey / WatermelonProvider.js
Created February 12, 2023 16:13 — forked from sidferreira/WatermelonProvider.js
WatermelonDB preloaded db
import React, { ReactChild } from 'react';
import { Database } from '@nozbe/watermelondb';
import { getWatermelon } from 'app/utils/DBWatermelonOld/DBWatermelonOld';
import DatabaseProvider from '@nozbe/watermelondb/DatabaseProvider';
const WatermelonProvider = (props) => {
const watermelonRef = React.useRef();
const [database, setDatabase] = React.useState();
if (!watermelonRef.current) {
@odesey
odesey / aws-sns-example.js
Created May 29, 2020 21:21 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@odesey
odesey / PhotoStation_remote_api.md
Created April 9, 2019 19:16 — forked from anthonydahanne/PhotoStation_remote_api.md
*unofficial* Documentation of the Synology PhotoStation remote api

Logging in :

POST /photo/mApp/ajax/login.php HTTP/1.1
Content-Length: 113
Content-Type: application/x-www-form-urlencoded
Host: 192.168.1.2:80
Connection: Keep-Alive

action=login&username=user&passwd=password&video_formats=%5B%5B%22*%22%2C0%2C0%2C1280%2C720%2C0%2C%5B%5D%5D%5D
@odesey
odesey / regex.txt
Created May 13, 2018 16:56 — forked from nerdsrescueme/regex.txt
Common Regex
Perl and PHP Regular Expressions
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
//All major credit cards regex
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/'
@odesey
odesey / calendar.js
Created July 27, 2016 17:57 — forked from jurajkrivda/calendar.js
Reactive fullcalendar
Template.Calendar.onCreated(function () {
const instance = this;
instance.viewDate = new ReactiveVar();
instance.autorun(() => {
const viewDate = instance.viewDate.get();
if (typeof viewDate !== 'undefined') {
const startDate = Math.round(viewDate.start / 1000);
###
This gist illustrates how to create and execute a payment with Paypal using their REST API.
For additional informations, check the documentation: https://developer.paypal.com/docs/api/
Note 1: I assume that you have already created a developer account for Paypal and an application.
To test that your code is working, use the sandbox accounts.
https://developer.paypal.com/webapps/developer/applications/accounts
Note 2: we will not use the Paypal REST API SDK package for Node.js
https://github.com/paypal/rest-api-sdk-nodejs