Skip to content

Instantly share code, notes, and snippets.

View carlosrodriguez's full-sized avatar

Carlos Rodriguez carlosrodriguez

View GitHub Profile
@aweber1
aweber1 / Welcome.jsx
Last active January 20, 2020 19:35
Sitecore JSS manifesterator
// React component
import React from 'react';
import PropTypes from 'prop-types';
import { Placeholder } from '@sitecore/sitecore-jss-react';
const Welcome = (props) =>
(<div>
Welcome to Sitecore!
<Placeholder name="page-header" />
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12: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
@rtgibbons
rtgibbons / post_test.js
Last active October 1, 2015 19:26
mocha test on Keystone Model
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
require('dotenv').load();
var keystone = require('keystone');
var chai = require('chai');
var dbURI = process.env.MONGO_URL
keystone.init({
'name': 'Post Model Test',
's3 config': {} //has to be set, but isn't used in our models
@markjaquith
markjaquith / nginx.erb
Created April 19, 2014 17:21
Nginx setup
server {
listen 80;
<% if @use_ssl %>
listen 443 ssl spdy;
ssl_certificate ssl/<%= @domain %>/server.crt;
ssl_certificate_key ssl/<%= @domain %>/server.key;
<% end %>
server_name <%= @domain %><% if @also_www %> www.<%= @domain %><% end %>;
access_log /var/log/nginx/access.log main;
@julianduque
julianduque / 00-README.md
Last active January 14, 2023 23:11
Primus + MQTT + Arduino == Internet of Things!

Primus + MQTT + Arduino == Internet of Things!

LCD Shield

Server

  1. Install dependencies
$ npm install
@jvns
jvns / interview-questions.md
Last active April 25, 2024 15:52
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@sindresorhus
sindresorhus / post-merge
Last active February 14, 2024 06:20
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@markjaquith
markjaquith / gist:7029068
Created October 17, 2013 17:37
How to get git-svn working in OS X Mavericks with Homebrew
sudo xcodebuild -license
xcode-select --install # There will be a GUI prompt
sudo cpan SVN::Core # use the "sudo" method when prompted
# Then add this to your ~/.profile:
# export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH
# Then probably:
brew reinstall git
brew reinstall subversion
@stevenharman
stevenharman / postgres_open_connections.sql
Last active April 3, 2018 17:23
View open connections to a PostgreSQL 9.2+ database. Quite useful when you're seeing ActiveRecord::ConnectionTimeoutError on Heroku.
-- On Heroku:
-- $ heroku pg:psql
-- An explaination of the columns on the pg_stat_activity table:
-- http://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
select
pid, application_name, query, waiting, state, state_change
from pg_stat_activity
where usename = current_user
order by state_change desc;
@francoishill
francoishill / gist:6483997
Created September 8, 2013 11:27
Media queries for mobile devices - Requires at least requires the meta viewport tag with content 'width=device-width'
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100