Skip to content

Instantly share code, notes, and snippets.

View piotr-galas's full-sized avatar
😀

Piotr piotr-galas

😀
View GitHub Profile
@guilhermebruzzi
guilhermebruzzi / remove-immutable.md
Last active April 16, 2024 17:46
Remove Immutable JS from your source code

I decided to remove all Immutable code on our big project because it wasn't causing our React to render less (using selectors on our redux layer was actually better).

Since our project has tests to check if everything is still working, I was able to achieve that with the following steps:

Search on all files on vscode or any editor with Use Regular Expression option (command+alt+r on vscode):

(Immutable|\.(size|count\(|toJS(?!\w)|fromJS(?!\w)|first[\(\)]|get\(|set\(|findEntry\(|getIn\(|setIn\(|contains\(|delete\(|asImmutable|add\())

Then on each find that was actually from a Immutable code:

  • Remove Immutable imports
@simone-sanfratello
simone-sanfratello / mscorefonts.sh
Created May 15, 2017 09:37
Install ms core fonts on Debian 8.x, Ubuntu 16.x
#!/bin/bash
wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb
apt install ./ttf-mscorefonts-installer_3.6_all.deb
@dbashford
dbashford / foo.md
Last active January 20, 2022 22:09
Using both redux-immutablejs and redux-optimist

redux-optimist usage

import optimist from 'redux-optimist';
import { combineReducers } from 'redux';
import todos from './todos';

export default optimist(combineReducers({
  todos
}));
@wosephjeber
wosephjeber / ngrok-installation.md
Last active March 22, 2024 15:55
Installing ngrok on Mac

Installing ngrok on OSX

For Homebrew v2.6.x and below:

brew cask install ngrok

For Homebrew v2.7.x and above:

@danvbe
danvbe / Paypal.php
Last active September 26, 2017 07:14
Sonata PayPal issue fix
<?php
/**
* Created by PhpStorm.
* User: danvbe
* Date: 7/25/14
* Time: 2:49 PM
*/
namespace Application\Sonata\PaymentBundle\Component;
@varinen
varinen / mysql4-install-0.1.0.php
Created December 17, 2012 22:04
One possible approach to adding attribute sets and groups in Magento
<?php
/**
* Installer script
*
* @category Solvingmagento
* @package Solvingmagento_Samples
* @author Oleg Ishenko <oleg.ishenko@solvingmagento.com>
* @copyright Copyright (c) 2012 - 2013 Oleg Ishenko
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @version GIT: <0.1.0>
@lucasdavila
lucasdavila / 1_ubuntu_terminal_command
Last active February 21, 2024 16:26
Installing Source Code Pro fonts in ubuntu
# to execute this gist, run the line bellow in terminal
\curl -L https://raw.github.com/gist/3875946/install_source_code_pro.sh | sh
@traviskroberts
traviskroberts / gist:2830535
Created May 29, 2012 20:33
FactoryGirl Polymorphic Association
class Alert < ActiveRecord::Base
belongs_to :alertable, :polymorphic => true
end
class Region < ActiveRecord::Base
has_many :alerts, :as => :alertable
end
@lancejpollard
lancejpollard / awesome_nested_set_optimization_helper.rb
Created July 2, 2010 01:39
Goal: Convert entire hierarchy of models into tree in 1 database call, such that you can loop through them depth-first
def simple_nested_set(clazz) # Post for example
stack = [] # Post for example
result = []
clazz.all(:order => "lft").each do |node|
if stack.empty?
stack.push({:node => node, :children => []})
result << stack.last
next
end
if stack.last[:node].lft < node.lft && node.lft < stack.last[:node].rgt
@hubgit
hubgit / blank-html-template
Created April 5, 2009 15:02
A blank HTML Strict template
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Title</title>
<link rel="stylesheet" href="style.css"/>
<style></style>
<script src="script.js"></script>