Skip to content

Instantly share code, notes, and snippets.

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

Diego Collares Senhordim

🏠
Working from home
View GitHub Profile
@Senhordim
Senhordim / run_tests.sh
Created March 25, 2023 23:31 — forked from mmcc007/run_tests.sh
Run tests with code coverage on all packages in a Flutter repo and combine coverage data into a single file for reporting
#!/usr/bin/env bash
# remember some failed commands and report on exit
error=false
show_help() {
printf "usage: $0 [--help] [--report] [<path to package>]
Tool for running all unit and widget tests with code coverage.
(run from root of repo)
@Senhordim
Senhordim / icon_gradient.dart
Last active March 25, 2020 16:28 — forked from mjohnsullivan/icon_gradient.dart
Aplicar gradiente em um Icon no Futter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
@Senhordim
Senhordim / banco_codigo.json
Created November 13, 2019 14:05 — forked from antoniopresto/banco_codigo.json
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{
@Senhordim
Senhordim / view_cart.html
Created February 14, 2019 18:25 — forked from onefriendaday/view_cart.html
Pagseguro checkout transparent
<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>
<script type="text/javascript">
var paymentModule = 'pagseguro_app';
checkoutCallbacks.add(pagseguroCheckout);
function pagseguroCheckout() {
if ($('input[name=module]').val() == paymentModule) {
@Senhordim
Senhordim / express-server-side-rendering.md
Created July 11, 2017 02:08 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@Senhordim
Senhordim / friendly_urls.markdown
Created August 19, 2016 22:29 — forked from cdmwebs/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@Senhordim
Senhordim / migrate.sh
Created November 20, 2015 00:40 — forked from tobi-pb/migrate.sh
Upgrade MAMP to Mysql 5.6
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
// Delete confirmation modals
$('#delete-confirm').on('show', function() {
  var $submit = $(this).find('.btn-danger'),
      href = $submit.attr('href');
  $submit.attr('href', href.replace('pony', $(this).data('id')));
});
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>