Skip to content

Instantly share code, notes, and snippets.

View mcloide's full-sized avatar

Cristiano Diniz da Silva mcloide

View GitHub Profile
@mcloide
mcloide / gist:4162042
Created November 28, 2012 15:38
Bash Profile Path Formatting with Git Branch
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset=`tput sgr0`
c_user=`tput setaf 2; tput bold`
c_path=`tput setaf 4; tput bold`
c_git_clean=`tput setaf 2`
c_git_dirty=`tput setaf 1`
else
c_reset=
c_user=
c_path=
@mcloide
mcloide / gist:4355143
Created December 21, 2012 19:25
specs
1 x Case Battalion 101 W350ETQ 15.6" Full HD 1920x1080 Widescreen LED TFT Laptop w/HDMI Port, USB 3.0 port, fingerprint Reader, Li-Ion Battery, Universal AC Power Adapter - Original Metallic black
1 x Processor Intel® Core™ i7-3630QM Mobile Processor (4x 2.4GHz/6MB L3 Cache)
1 x Memory 16GB [8GB x 2] 1333MHz DDR3 SDRAM [Laptop Memory] - Corsair or Major Brand **FREE Upgrade to 16GB [8GB x2] DDR3-1600 G.Skill**
1 x Video Card NVIDIA GeForce GTX 660M 2GB GDDR5 Video w/ NVIDIA Optimus [W350ETQ]
1 x Primary Hard Drive 256 GB ADATA SP900 SSD - Single Drive
1 x Data Hard Drive 500 GB 5400rpm Serial-ATA Super Slim Laptop Hard Drive
1 x Optical Drive 8x Dual Format DVD±R/±RW + 16x CD-R/RW Combo Drive [W350ETQ]
1 x Flash Media Reader / Writer Built-in 9-in-1 Media Card Reader/Writer [Laptop]
1 x Sound Card 3D Premium Surround Sound Onboard
1 x Network Card Built-in 10/100/1000 Mbps LAN [Laptop]
@mcloide
mcloide / gist:5828495
Last active December 18, 2015 18:49
dxdiag
------------------
System Information
------------------
Time of this report: 1/25/2013, 16:51:06
Operating System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.120830-0333)
Language: English (Regional Setting: English)
System Manufacturer: CLEVO CO.
System Model: W35_37ET
BIOS: BIOS Date: 10/26/12 14:53:27 Ver: 04.06.05
Processor: Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz (8 CPUs), ~2.4GHz
@mcloide
mcloide / gist:9219465
Last active August 29, 2015 13:56
Sometimes lack of knowledge in JS kills and this is why
$(document).ready(function(){
console.clear();
console.log('STARTING THE TEST');
var wrapper = $('#wrapper'),
enabled_1 = Boolean(wrapper.attr('data-feature-enabled')),
enabled_2 = Boolean(wrapper.data('feature-enabled')),
enabled_3 = Boolean(wrapper.prop('data-feature-enabled'));
console.log(enabled_1 + ': expected false');
console.log(enabled_2 + ': expected false - correct');
@mcloide
mcloide / 0_reuse_code.js
Created May 5, 2014 14:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mcloide
mcloide / cake2_app_controller
Last active August 29, 2015 14:16
Cake2 vs Cake3 cipherseed
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@mcloide
mcloide / new_gist_file.php
Created February 26, 2015 20:38
Existing App Controller
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@mcloide
mcloide / file1.php
Last active August 29, 2015 14:17
Do you understand PHP garbage collection? What is the result of each of the gist files?
<?php
class foo
{
public $bar = 1;
function bar()
{
echo $this->bar;
}
@mcloide
mcloide / new_gist_file.php
Last active August 29, 2015 14:18
google-php-community-help
<html>
<body>
<?php
$query = "select * from ad where id='0'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$abc = urlencode($row['ad_link']);
?>
<a target="_blank" href="<?php echo $abc; ?>" rel="tag">
@mcloide
mcloide / prune-local-git-branches.md
Created October 27, 2015 13:30
Drop local branches which have been removed from remote.

Drop local branches which have been removed from remote.

git branch -vv | awk '/gone/ {print $1}' | xargs git branch -d`

Warning:

It uses the word gone in the output of git branch -vv so if your commit line has that it can become a false positive.