Skip to content

Instantly share code, notes, and snippets.

View dhyegocalota's full-sized avatar
🎯
I build results through Software Engineering.

Dhyego Calota dhyegocalota

🎯
I build results through Software Engineering.
View GitHub Profile
@mknabe
mknabe / README.md
Last active September 18, 2021 09:14
React component to warn users about unsaved changes to forms when they attempt navigate away from the page using redux-form

Use with the following

  • react-router
  • redux-form

You must use this compontent on the route component where the form is shown not on the form component itself. This is because this.props.route is only added to route components, and I didn't want to pass that down through props.

Inspired by this Codepad

Feedback appreciated

@davidderus
davidderus / .dockerignore
Last active March 3, 2024 10:15
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
@mmazzarolo
mmazzarolo / Appfile
Created May 17, 2016 11:27
Simple Fastlane setup for React-Native (Android - iOS)
# iOS
app_identifier "com.myapp.app" # The bundle identifier of your app
apple_id "me@gmail.com" # Your Apple email address
team_id "1234ABCD" # Developer Portal Team ID
# Android
json_key_file "./google-play-api-secret.json" # Path to the json secret file - Follow https://github.com/fastlane/supply#setup to get one
package_name "com.myapp.app" # Your Android app package
// var products = [{ sku: 1 }, { sku: 2 }]; // Sample data (SKU of products from Magento Database)
var productsSku = products
.map(product => (product.sku || '').toString())
.map(sku => sku.split(' ').filter(node => node.match(/^\S+$/)))
.reduce((acc, target) => Array.prototype.concat.apply(acc, target))
.filter((value, index, self) => self.indexOf(value) === index)
.map(sku => `'${sku}'`)
.sort((x, y) => x - y)
.join(', ');
@dhyegocalota
dhyegocalota / decorator
Created September 30, 2015 12:31 — forked from johgusta/decorator
Disable JIT compiler on Safari for $new
angular.module('lib.decorators', [])
.config(['$provide', function($provide){
'use strict';
var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
if(isSafari) {
$provide.decorator('$rootScope', ['$delegate', function($rootScope) {
var scopePrototype = Object.getPrototypeOf($rootScope);
var originalScopeNew = scopePrototype.$new;
@johgusta
johgusta / decorator
Last active December 15, 2016 17:03
Disable JIT compiler on Safari for $new
angular.module('lib.decorators', [])
.config(['$provide', function($provide){
'use strict';
var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
if(isSafari) {
$provide.decorator('$rootScope', ['$delegate', function($rootScope) {
var scopePrototype = Object.getPrototypeOf($rootScope);
var originalScopeNew = scopePrototype.$new;
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 25, 2024 16:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@tronsha
tronsha / installphp7.sh
Last active October 13, 2023 00:13
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@consti
consti / hosts
Last active April 23, 2024 19:50
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@jelbourn
jelbourn / api-provider.js
Last active February 25, 2024 12:51
Example of using an angular provider to build an api service. Subject of August 20th 2013 talk at the NYC AngularJS Meetup. http://www.meetup.com/AngularJS-NYC/events/134578452/See in jsbin: http://jsbin.com/iWUlANe/5/editSlides: https://docs.google.com/presentation/d/1RMbddKB7warqbPOlluC7kP0y16kbWqGzcAAP6TYchdw
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (@jelbourn)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/