Skip to content

Instantly share code, notes, and snippets.

View felippenardi's full-sized avatar

Felippe Nardi felippenardi

View GitHub Profile
@felippenardi
felippenardi / readme.md
Last active February 1, 2024 11:06
Benchmarking AngularJS performance

Benchmarking AngularJS performance

Things to optmize

  • Use one-time-bind on expressions ( {{::value}} )
  • Replace $scope.$apply() with $scope.$digest() whenever possible
  • Move filters to controllers

Measuring Watch list

To get the total watchers on the current page, you can run this script on the browser console:

@felippenardi
felippenardi / gist:ff56297c002c9a937b0df160fb1d4b1f
Created August 5, 2022 22:57
Mark as complete on Circle communities
<style>
/* Add "Completed" to like buttons */
.view-space-in-group--88671 .action-link,
.view-space-in-group--88671 .action-like.action-item {
background-color: var(--brand);
padding: 4px 8px;
border-radius: 11px;
opacity: 1;
}
@felippenardi
felippenardi / run_eslint.sh
Last active February 14, 2022 12:02
Shell script to Run Eslint only on modified files
#!/bin/bash
CHANGED_FILES=`git diff origin/master...HEAD --name-only`
node_modules/eslint/bin/eslint.js -f json $CHANGED_FILES --quiet | node_modules/eslines/index.js --quiet
if [[ $? != 0 ]] ; then
echo "Fix style violations"
exit 1
fi
echo "All changed files are good"
@felippenardi
felippenardi / running-protractor-with-docker.md
Last active July 19, 2020 04:38
Running Protractor Headless with Docker

Running Protractor Headless with Docker

Setting up Docker

1st Docker: Selenium Webdriver

This docker image is a Selenium Webdriver server where our specs will be directed against. It contains the Firefox and Chrome to run our specs headless. It also provides us VNC access to check what is going on the browser.

$ docker run --rm --net="host" -e VNC_PASSWORD=pancakes elgalu/selenium:v2.45.0-ssh3
@felippenardi
felippenardi / machine.js
Created February 14, 2020 18:55
Generated by XState Viz: https://xstate.js.org/viz
var contentEditorMachine = Machine({
id: 'content',
strict: true,
initial: 'unknown',
context: {
variants: [
{ id: '1', status: 'draft' },
{ id: '2', status: 'live' },
],
currentVariant: {
@felippenardi
felippenardi / machine.js
Created February 12, 2020 20:38
Generated by XState Viz: https://xstate.js.org/viz
var contentEditorMachine = Machine({
id: 'content',
strict: true,
initial: 'unknown',
on: {
CLEAR_ERROR: {
actions: 'clearError'
}
},
context: {
@felippenardi
felippenardi / machine.js
Last active February 8, 2020 22:02
Generated by XState Viz: https://xstate.js.org/viz
var variantEditorMachine = Machine({
id: 'editing',
initial: 'editing',
states: {
editing: {
id: 'live',
on: {
SAVE_CHANGES: 'saving',
DISCARD_CHANGES: 'confirmingDiscard'
@felippenardi
felippenardi / machine.js
Last active February 6, 2020 14:51
Generated by XState Viz: https://xstate.js.org/viz
const editingMachine = Machine({
id: 'editing',
initial: 'editing',
states: {
editing: {
id: 'live',
on: {
SAVE_CHANGES: 'saving',
DISCARD_CHANGES: 'confirmingDiscard'
}
@felippenardi
felippenardi / machine.js
Last active February 3, 2020 18:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@felippenardi
felippenardi / machine.js
Last active February 1, 2020 23:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions