Skip to content

Instantly share code, notes, and snippets.

Avatar

Miguel Solano miguelsolano

View GitHub Profile
@miguelsolano
miguelsolano / reacttictac
Last active Aug 29, 2015
ReactTicTacToe - 40 digits code review
View reacttictac
/**
* @jsx React.DOM
*/
//the top part is absolutely necessary dont erase, its for the jsx compiler
//wrapped the game functionality in an iife
(function() {
//the game board
var Board = React.createClass({
@miguelsolano
miguelsolano / SQL Queries
Created Feb 25, 2016
Useful SQL queries that I have written in the past
View SQL Queries
UPDATE region SET custom_regional_content = REPLACE(custom_regional_content, 'src="//', 'src="https://') WHERE INSTR(custom_regional_content, 'src="//') > 0;
View .vimrc
" VIM IS AWESOME
" =================
" Plugin Resource: vimawesome.com
"
" Setup instructions
" ++++++++++++++++++
" cd ~ && vim .vimrc (if you have a .vimrc )
" cd ~ && touch .vimrc && vim .vimrc (if you do not have a .vimrc)
" paste the contents of this file start at the @START line (copy the contents switch back to the vim window and run
" ```:set paste``` afterwards paste the contents in and run ```:source %``` then run ```:PluginInstall```)
@miguelsolano
miguelsolano / Io Example Problems
Created Apr 20, 2016 — forked from jezen/Io Example Problems
The example problems have gone missing from the Io language website, so here’s a backup.
View Io Example Problems
#Sample code
#Hello world
"Hello world!" print
#Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
View completely_clean_mysql_from_ubunutu
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
// Also helpful
sudo apt-get autoremove
sudo apt-get autoclean
@miguelsolano
miguelsolano / cookie.js
Created Aug 24, 2016
SetCookie function in js
View cookie.js
@miguelsolano
miguelsolano / ko-config.js
Created Feb 17, 2018
An automatic string translate for Magento 2 KO components
View ko-config.js
define(['ko', 'mage/translate'], function (ko) {
/**¬
* @description runs every string that is bound through $.mage.__ (translation)¬
* @param val¬
* @returns {string
*/¬
ko.bindingHandlers.text.preprocess = function (val) {¬
return $.mage.__(val);¬
};¬
@miguelsolano
miguelsolano / avvoiding-positional-arguments.js
Last active Oct 22, 2018
Avoiding Positional Arguments in Javascript
View avvoiding-positional-arguments.js
/**
Positional arguments in code often become a pain as when something is updated then every instance of
the constructor instance must be updated. Thanks to Sandi Metz's POODR, I became aware of this problem and
thought i'd write a quick gist showing how such a problem could be resolved in Javascript.
*/
// Positional Constructor
function Wallet(license, creditCard, libraryCard) {
this.license = license;
this.creditCard = creditCard;
You can’t perform that action at this time.