Skip to content

Instantly share code, notes, and snippets.

View miguelfrias's full-sized avatar

Miguel Angel Frías Bonfil miguelfrias

  • Globant
  • Los Angeles
View GitHub Profile
@miguelfrias
miguelfrias / mysql-docker.sh
Created April 28, 2019 01:16 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@miguelfrias
miguelfrias / wordpress-create-user.php
Created September 14, 2016 02:56
Wordpress script to create users
<?php
/*
* Create Admin User
*/
$jb_password = 'PASSWORD'; #enter your desired password here, if you don't line 16 makes sure nothing bad happens like setting you actual password to 'PASSWORD'
$jb_username = 'user';
$jb_email = 'user@example.com';
if ( $jb_password === 'PASSWORD' )
AddDefaultCharset UTF-8
Timeout 60
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minimal | Minor | Major | Prod
(function() {
'use strict';
function revocable(func1) {
return {
invoke: function(a) {
return func1.apply(
this,
arguments
);
## Performance
- [Disable Debug Data](https://docs.angularjs.org/guide/production#disabling-debug-data)
- Use track by in every ng-repeat
## Cleaning
AngularJS does some work on your behalf, but not all. The following need to be manually cleaned up:
- Any watchers that are not bound to the current scope (e.g. bound to $rootScope)
- Intervals
- Timeouts
@miguelfrias
miguelfrias / installJSDependencies.js
Created January 27, 2016 07:30
installJSDependencies
(function installJSDependencies() {
'use strict';
console.log('------------------');
console.log('Post install: install dependencies');
console.log('------------------');
var nodeModulesFolder = '/node_modules/';
var pluginsForlder = '/dumbometeranalyzer/app/webroot/plugins/lib/';
var fse = require('fs-extra');
@miguelfrias
miguelfrias / sm-annotated.html
Created December 4, 2015 17:08 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@miguelfrias
miguelfrias / Contract Killer 3.md
Created October 15, 2015 16:21 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@miguelfrias
miguelfrias / what-forces-layout.md
Last active September 21, 2015 15:31 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->