Skip to content

Instantly share code, notes, and snippets.

Alexandre Gaudencio Shahor

View GitHub Profile
@seanhandley
seanhandley / docker-compose.yml
Last active Jul 1, 2020
How To Set Up Docker For Mac (Mojave) with Native NFS
View docker-compose.yml
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@paulirish
paulirish / what-forces-layout.md
Last active Jul 2, 2020
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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
@TSiege
TSiege / The Technical Interview Cheat Sheet.md
Last active Jul 2, 2020
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@madx
madx / has_events.js
Created Apr 8, 2014
Simple Events as a functional mixin
View has_events.js
var hasEvents = (function() {
function on(name, callback, listener) {
var listener = listener || this
this._events = this._events || []
this._events.push({
name: name,
callback: callback,
listener: listener
})
@am
am / shell
Created Jan 26, 2014
Kaleidodcope "xcrun: error: cannot be used within an App Sandbox..."
View shell
cd /Applications/Kaleidoscope.app/Contents/Resources/Integration/scripts
./install_git-default
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active Jul 2, 2020
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@bentruyman
bentruyman / Custom.less
Created Jul 3, 2012
Tomorrow Theme for Chrome Developer Tools
View Custom.less
/**********************************************/
/*
/* Tomorrow Skin by Ben Truyman - 2012
/*
/* Based on Chris Kempson's Tomorrow Theme:
/* https://github.com/ChrisKempson/Tomorrow-Theme
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@evanbeard
evanbeard / registrations_controller.rb
Created May 11, 2012 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
View registrations_controller.rb
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@nijikokun
nijikokun / example-user.js
Created May 3, 2012
Beautiful Validation... Why have I never thought of this before?!
View example-user.js
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@peternixey
peternixey / securing_rails_updates.md
Created Mar 5, 2012
How Homakov hacked GitHub and how to protect your application by Peter Nixey
View securing_rails_updates.md

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


You can’t perform that action at this time.