Skip to content

Instantly share code, notes, and snippets.

Avatar

Cristiano Diniz da Silva mcloide

View GitHub Profile
@mcloide
mcloide / gist:9219465
Last active Aug 29, 2015
Sometimes lack of knowledge in JS kills and this is why
View gist:9219465
$(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
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mcloide
mcloide / new_gist_file.php
Created Feb 26, 2015
Existing App Controller
View new_gist_file.php
<?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 / cake2_app_controller
Last active Aug 29, 2015
Cake2 vs Cake3 cipherseed
View cake2_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 Aug 29, 2015
Do you understand PHP garbage collection? What is the result of each of the gist files?
View file1.php
<?php
class foo
{
public $bar = 1;
function bar()
{
echo $this->bar;
}
@mcloide
mcloide / new_gist_file.php
Last active Aug 29, 2015
google-php-community-help
View new_gist_file.php
<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 / gist:4162042
Created Nov 28, 2012
Bash Profile Path Formatting with Git Branch
View gist:4162042
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 / prune-local-git-branches.md
Created Oct 27, 2015
Drop local branches which have been removed from remote.
View prune-local-git-branches.md

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.

View gist:4355143
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]
View gist:5828495
------------------
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
You can’t perform that action at this time.