Skip to content

Instantly share code, notes, and snippets.

View mateuslopes's full-sized avatar

Mateus Lopes mateuslopes

View GitHub Profile
@bretton
bretton / lightning-maps.md
Last active June 4, 2024 12:36
Visualisers of the Lightning Network (and some other explorers)

A (mostly) visual collection of the Lightning Network

Disclaimer

Network views tend to be the view of the network from a single node, or small selection of nodes. They are not complete views of the network. This is impossible to achieve. Even if many node views were combined, it would still be incomplete.

These network views, or network maps, have been termed 'visualisers' by the LN community.

Screenshots may reflect older visual styles, and are dated accordingly.

@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20:47
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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
# add the email package
meteor add email
@mholt
mholt / interface_spider.go
Created August 4, 2014 23:04
Crawls golang.org/pkg for interfaces and writes them to a file.
package main
import (
"log"
"os"
"strings"
gq "github.com/PuerkitoBio/goquery"
)
@mateuslopes
mateuslopes / cleanQuery.php
Created June 3, 2012 18:29 — forked from boopathi/cleanQuery.php
MySQL+Security: Escape MySQL queries preventing injections
<?php
/** Function to sanitize values received from the form. Prevents SQL injection */
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
?>
@mateuslopes
mateuslopes / wp-change-site-url.sql
Last active February 19, 2020 13:43
SQL+Wordpress: Changing WP Site Url
SET NAMES 'utf8mb4';
SET CHARACTER SET 'utf8mb4';
SET @origin_url = 'http://localhost/origem';
SET @destiny_url = 'http://localhost/destino';
UPDATE wp_options
SET option_value = REPLACE(option_value, @origin_url, @destiny_url)
WHERE option_value LIKE (CONCAT('%',@origin_url,'%'));
@travist
travist / gist:2863998
Last active October 5, 2015 19:37
Dynamically add javascript to your page
// Conditionally loads scripts.
var loadScripts = function(params) {
// Iterate over each source.
var eachSource = function(callback) {
if (typeof params.scripts == 'string') {
callback(params.scripts);
}
else {
for (var i=0; i < params.scripts.length; i++) {
@ThomasBurleson
ThomasBurleson / gist:2432692
Last active March 20, 2017 10:07
AngularJS - RESTful CRUD with Services and $http
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {