Skip to content

Instantly share code, notes, and snippets.

View renatorib's full-sized avatar

Renato Ribeiro renatorib

View GitHub Profile
@marcosvidolin
marcosvidolin / kill_port_process.sh
Last active June 8, 2021 10:34
Linux: How to list and kill a process using a port
# to list all ports that are used
sudo netstat -ntlp | grep LISTEN
# you can obtain a specific port using the following command
sudo netstat -ntlp | grep :8080
# when you execute the command above you will see something like that
tcp 0 0 0.0.0.0:27370 0.0.0.0:* LISTEN 4394/skype
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 2216/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 4912/cupsd
@pedronauck
pedronauck / controlAsyncFlow.js
Created September 7, 2014 05:58
Example using async library to avoid callback hell
var async = require('async');
var Product = require('../model/Product');
var Category = require('../model/Category');
var Attribute = require('../model/Attributes');
// bad idea
exports.index = function() {
Product.find(function(err, products) {
Category.find(function(err, categories) {
Attribute.find(function(err, attributes) {
@trajakovic
trajakovic / BootstrapFormHelper.php
Last active December 16, 2018 18:18
This file is taken from https://github.com/CCadere/CakePHP-Forms-Bootstrap-2.3-Helper/blob/master/View/Helper/BootstrapFormHelper.php, and slightly modified/extended. Added support for has-error bs3 validation error class.
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
*
* Licensed under The MIT License
*
* Copyright (c) La Pâtisserie, Inc. (http://patisserie.keensoftware.com/)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('FormHelper', 'View/Helper');

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@mckamey
mckamey / bezier.js
Created September 25, 2012 16:35
JavaScript port of Webkit CSS cubic-bezier(p1x.p1y,p2x,p2y) and various approximations
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@cowboy
cowboy / 1.before.js
Created June 25, 2012 17:46
grunt: an example of building task targets dynamically
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
min: {
ariaAccessibility: {
src: ['src/javascripts/jquery.selectBoxIt.ariaAccessibility.js'],
dest: 'src/javascripts/jquery.selectBoxIt.ariaAccessibility.min.js'
},
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jadell
jadell / Actor.php
Last active June 2, 2016 07:55
Neo4j and PHP sample application
<?php
use Everyman\Neo4j\Node,
Everyman\Neo4j\Index;
class Actor
{
public $id = null;
public $name = '';
protected $node = null;
@mxriverlynn
mxriverlynn / 1-view-events.js
Created September 15, 2011 15:37
zombies! run!
MyView = Backbone.View.extend({
events: {
"click #someButton": "doThat",
"change #someInput": "changeIt"
},
doThat: function(){ ... },
changeIt: function(){ ... }
});