Skip to content

Instantly share code, notes, and snippets.

View dremendes's full-sized avatar
🏠
Working from home

André Mendes dremendes

🏠
Working from home
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@addyosmani
addyosmani / headless.md
Last active May 17, 2024 03:38
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@cassiocardoso
cassiocardoso / select-estados-br
Created February 12, 2014 23:31
Select com uma lista de todos os estados brasileiros.
<select name="estados-brasil">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>
@dengshuan
dengshuan / ckedit.py
Last active January 29, 2020 20:31 — forked from mrjoes/ckedit.py
Apply ckeditor(WYSIWYG rich text editor) to flask-admin textarea
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import admin
from wtforms import TextAreaField
from wtforms.widgets import TextArea
from flask.ext.admin.contrib.sqla import ModelView
app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
@nk9
nk9 / largestFiles.py
Last active November 7, 2024 10:22
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
[
{ "keys": ["ctrl+t"], "command": "phpunit_run_tests" },
{ "keys": ["ctrl+shift+."], "command": "phpunit_run_all_tests" },
{ "keys": ["ctrl+shift+,"], "command": "phpunit_open_class_being_tested" },
{ "keys": ["ctrl+shift+1"], "command": "run_macro_file", "args": {"file": "res://Packages/User/var_dump.sublime-macro"} },
{ "keys": ["ctrl+shift+2"], "command": "run_macro_file", "args": {"file": "res://Packages/User/ini_set.sublime-macro"} },
{ "keys": ["ctrl+shift+3"], "command": "run_macro_file", "args": {"file": "res://Packages/User/importante.sublime-macro"} },
{ "keys": ["ctrl+shift+["], "command": "bh_key", "args": { "no_outside_adj": true, "lines" : true, "plugin": { "type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "left"} }}},
{ "keys": ["ctrl+shift+]"], "command": "bh_key", "args": { "no_outside_adj": true, "lines" : true, "plugin": { "type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "right"} }}},
{ "keys": [
@EduardoMRB
EduardoMRB / post-receive
Last active August 29, 2015 14:22
PHP deploy skeleton
#!/bin/bash
set -e
# file: hooks/post-receive inside git repository.
$WORK_DIR=path/to/work/directory
$GIT_DIR=path/to/git/directory
git --work-tree=$WORK_DIR --git-dir=$GIT_DIR checkout -f
@laughinghan
laughinghan / InterVer.md
Last active January 6, 2024 07:22
Interface Versioning - Never break backcompat, keep the API nimble

Interface Versioning (InterVer)

Never break backcompat, keep the API nimble

An extension of SemVer with a stricter (yet more realistic) backcompat guarantee, that provides more flexibility to change the API, for libraries that are packaged and downloaded (not services accessed remotely over the Internet (see Note 4)).

@EduardoMRB
EduardoMRB / gulpfile.js
Last active September 10, 2015 15:12
Gulpfile with browsersync serving assets withou refresh.
var gulp = require("gulp"),
concat = require("gulp-concat"),
minify = require("gulp-minify-css"),
sass = require("gulp-sass"),
sourcemaps = require("gulp-sourcemaps"),
rename = require("gulp-rename"),
php = require("gulp-connect-php"),
gulpif = require("gulp-if"),
env = process.env.NODE_ENV || "dev";