Skip to content

Instantly share code, notes, and snippets.

View francoatmega's full-sized avatar
🏠
Working from home

Jardel Matias francoatmega

🏠
Working from home
View GitHub Profile
@francoatmega
francoatmega / 01-Node-Npm-Yarn
Created June 21, 2020 22:45 — forked from felipe1181/01-Node-Npm-Yarn
Setting up the development environment for the commit
Node and NPM: https://nodejs.org/en/
YARN: https://yarnpkg.com/getting-started/install
@felipe1181
felipe1181 / 01-Node-Npm-Yarn
Last active June 21, 2020 22:50
Setting up the development environment for the commit
Node and NPM: https://nodejs.org/en/
YARN: https://yarnpkg.com/getting-started/install
@alexishida
alexishida / rtsp-intelbras-outros.txt
Last active April 5, 2024 17:34
RTSP dvr intelbras e outros
-------- Intelbras -------------------------------------------------------
rtsp://usuário:senha@ip:porta/cam/realmonitor?channel=1&subtype=0
-------- Luxvision -------------------------------------------------------
rtsp://ip:porta/user=[usuário]&password=[senha]&channel=1&stream=0.sdp
-------- Hikvision -------------------------------------------------------
rtsp://usuário:senha@ip:porta/Streaming/Channels/102
@lovemecomputer
lovemecomputer / getPropValue.js
Last active October 15, 2020 02:13
search within nested properties of an object, stops searching when hitting a null property — taken from: https://medium.com/javascript-inside/safely-accessing-deeply-nested-values-in-javascript-99bf72a0855a
/**
* search within nested properties of an object, stops searching when hitting a null property
* e.g. for this.soundCloudAudio._track.user.avatar_url,
* let avatarUrl = getPropValue( ['_track', 'user', 'avatar_url'], this.soundCloudAudio ) // assigned null if property doesn't exist
* @param {Array} pathToProp the path to a nested prop we hope to find, each step listed as an array value (string for keys, number for indexes)
* @param {Object} objectToScan the object to look through for all available properties based on the path above
* @return {varies} returns null, or the value found at the requested property
*/
const getPropValue = (pathToProp, objectToScan) =>
return pathToProp.reduce(
@sdnts
sdnts / example.md
Last active January 10, 2023 20:50
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
@igorbenic
igorbenic / refund_order.php
Last active November 5, 2021 00:32
How to Create WooCommerce Refunds Programmatically | ibenic.com/how-to-create-woocommerce-refunds-programmatically
<?php
/**
* Process Order Refund through Code
* @return WC_Order_Refund|WP_Error
*/
function ibenic_wc_refund_order( $order_id, $refund_reason = '' ) {
$order = wc_get_order( $order_id );
// IF it's something else such as a WC_Order_Refund, we don't want that.
@alexbruno
alexbruno / valid.cnpj.ts
Last active April 23, 2024 13:02
Validação de CNPJ
// Regex para validação de string no formato CNPJ
export const regexCNPJ = /^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/
// Método de validação
// Referência: https://pt.wikipedia.org/wiki/Cadastro_Nacional_da_Pessoa_Jur%C3%ADdica
export function validCNPJ(value: string | number | number[] = '') {
if (!value) return false
// Aceita receber o valor como string, número ou array com todos os dígitos
const isString = typeof value === 'string'
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@Svenito
Svenito / ImagePlayer.py
Created November 2, 2012 10:28
Python class to play an animated gif using PyQt
class ImagePlayer(QWidget):
def __init__(self, filename, title, parent=None):
QWidget.__init__(self, parent)
# Load the file into a QMovie
self.movie = QMovie(filename, QByteArray(), self)
size = self.movie.scaledSize()
self.setGeometry(200, 200, size.width(), size.height())
self.setWindowTitle(title)
@zziuni
zziuni / stuns
Created September 18, 2012 08:05
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net