Skip to content

Instantly share code, notes, and snippets.

View pedroppinheiro's full-sized avatar

Pedro Victor Pontes Pinheiro pedroppinheiro

View GitHub Profile
@mash
mash / prettyprintgist.md
Created July 1, 2016 08:38 — forked from magnetikonline/README.md
Bookmarklet to pretty print Gist pages without the usual page chrome, just content. Handy for Markdown document printing.

Pretty print bookmarklet helper for Gist pages

Create a new bookmark somewhere handy in your browser with the following URL:

javascript:var el=document.createElement('style');el.media='print';el.innerHTML='#header,.pagehead.repohead,.gist-description.container,.file-box .meta,#comments,.js-comment-form,.gist-header,.file-header,.gisthead,#footer{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Now, cmd+p to print');
  • Navigate to your Gist of choice
  • Hit the bookmarklet
  • Now print
@Daniel-Peder
Daniel-Peder / phpunit4netbeans.php
Last active February 27, 2019 08:15
netbeans 8.0.2 and PHPunit bug workaround
<?php
$phpunit_phar =__DIR__.'\\phpunit.phar'; // @edit path to Your phpunit
$php_exe_path='C:\Users\[username]\AppData\Local\PHP\v5.6\php.exe'; // @edit path to Your win php
array_splice($argv,-1,0,array("--")); // inject argument terminator
$argv[0] = $phpunit_phar; // inject phpuit path
array_unshift($argv,$php_exe_path); // inject php executable
//print_r($argv);
$cmd = '';
// build command line to execute
foreach($argv as $arg){
@FrancesCoronel
FrancesCoronel / sampleREADME.md
Last active March 26, 2024 01:21
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 1, 2024 17:49
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@learncodeacademy
learncodeacademy / gist:5850f394342a5bfdbfa4
Last active January 7, 2024 11:58
SSH Basics - Getting started with Linux Server Administration

###SSH into a remote machine###

ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1

exit: exit ###Install Something###

#If it's a new server, update apt-get first thing
@franzwong
franzwong / jsf.md
Created October 2, 2012 07:13
Jsf cheatsheet
  • usage of h:selectOneMenu
<h:selectOneMenu value="#{manageStudent.student.gender}">
    <f:selectItem itemLabel="- Select Gender -" itemValue=""/>
    <f:selectItems value="#{manageStudent.genders}"/>
</h:selectOneMenu>
  • get HttpServletRequest and HttpServletResponse in managed bean
@guisehn
guisehn / gist:3276302
Last active April 3, 2024 13:24
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;
@guisehn
guisehn / csrf.php
Created July 22, 2012 00:00
Simple class for CSRF protection
<?php
abstract class CSRF
{
const SESSION_NAME = 'nomedosite_csrf_token';
const FIELD_NAME = 'nomedosite_csrf_check';
private static function set_session()
{
if (!isset($_SESSION[self::SESSION_NAME]))