Skip to content

Instantly share code, notes, and snippets.

View richellyitalo's full-sized avatar
🏹
Exploring RemixJs

Richelly Italo richellyitalo

🏹
Exploring RemixJs
View GitHub Profile

swal({ title: '', content: { element: "div", attributes: { innerHTML: res.mensagem }, }, icon: "success" })

@richellyitalo
richellyitalo / contentattributes.php
Created August 7, 2019 01:40 — forked from enderandpeter/contentattributes.php
Using PHP's SimpleXML class to find the attributes of a <media:content> element in an MRSS file.
<?php
$mrss =<<<EOS
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
<title>My Movie Review Site</title>
<link>http://www.foo.com</link>
<description>I review movies.</description>
// IIFE - Immediately Invoked Function Expression
(function(yourcode) {
// The global jQuery object is passed as a parameter
yourcode(window.jQuery, window, document);
}(function($, window, document) {
// The $ is now locally scoped
// IIFE - Immediately Invoked Function Expression
(function($, window, document) {
// The $ is now locally scoped
// Listen for the jQuery ready event on the document
$(function() {
// The DOM is ready!

store/actions/todos.js

export const addTodo = text => ({ type: 'ADD_TODO', payload: { text } });

store/reducers/todos.js

const INITIAL_STATE = [
  { id: 1, text: 'Estudar pra caralho' },
  { id: 2, text: 'Estudar mais ainda' },
  { id: 3, text: 'Por em prática!' },

Converter valor string para tipo passado

import ast
boleano = 'True'
boleano_mesmo = ast.literal_eval(boleano)

flutuante = '100.50'
flutuante_mesmo = ast.literal_eval(flutuante)

Maneira 1

# A lógica é mantida dentro de um método da classe
# arquivo 'models.py'
from django.db.models.signals import post_save

class Product(TimestampableMixin):
    # ...

 @classmethod

exibindo variáveis do usuário autenticado

username = request.POST.get('username')
password = request.POST.get('password')
# from django.contrib.auth import authenticate
user = authenticate(username=username, password=password)
if user:
  vars(user) # mostra as variáveis do 'user'