Skip to content

Instantly share code, notes, and snippets.

View cezarsmpio's full-sized avatar
🌚
Hi!

Cezar Sampaio cezarsmpio

🌚
Hi!
View GitHub Profile
@cezarsmpio
cezarsmpio / Battery-API.markdown
Created April 16, 2014 13:44
A Pen by Cezar Luiz.
@cezarsmpio
cezarsmpio / DummyImageGeneratorSnippet.md
Last active August 29, 2015 14:03
Generate Dummy Image Snippet for Sublime Text

Dummy Image Snippet for Sublime Text

Generate images from dummyimage.com.

It's easy!

Type diand then press tab. Pass the sizes of image, background color, text color, format (.jpg, .gif or .png is default) and optional text.

@cezarsmpio
cezarsmpio / updateBrokenChars
Last active August 29, 2015 14:17
Atualizar caracteres quebrados MySQL
update `table` set `field` = replace(`field` ,'É','É');
update `table` set `field` = replace(`field` ,'“','"');
update `table` set `field` = replace(`field` ,'â€','"');
update `table` set `field` = replace(`field` ,'Ç','Ç');
update `table` set `field` = replace(`field` ,'Ã','Ã');
update `table` set `field` = replace(`field` ,'Ã ','À');
update `table` set `field` = replace(`field` ,'ú','ú');
update `table` set `field` = replace(`field` ,'•','-');
update `table` set `field` = replace(`field` ,'Ø','Ø');
update `table` set `field` = replace(`field` ,'õ','õ');
@cezarsmpio
cezarsmpio / clearFixSass
Created March 18, 2015 13:22
Clearfix sass
.clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
@cezarsmpio
cezarsmpio / sublime-packages.md
Created June 14, 2016 16:27
Sublime Packages

Sublime Packages

  • Emmet
  • DocBlockr
  • Babel
  • AutoFileName
@cezarsmpio
cezarsmpio / functions.php
Last active August 3, 2016 04:08
Wordpress - Get the post terms
<?php
/**
* Get the terms of specific post in a list
* @param object $p The post
* @param array $params An array of params
* @return string The HTML result
*/
function get_post_terms($p, $params = array()) {
$defaults = array(
@cezarsmpio
cezarsmpio / functions.php
Created July 26, 2016 02:56
Wordpress - Get page permalink by slug
<?php
/**
* The page permalink by slug
* @param string $slug The page slug
* @return string The permalink
*/
function page_permalink_by_slug($slug) {
return get_permalink( get_page_by_path( $slug ) );
}
{
"config": {
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "upper",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
@cezarsmpio
cezarsmpio / css.js
Created August 24, 2016 16:29
Add CSS with object
HTMLElement.prototype.css = function (style) {
for (let k in style) {
this.style[k] = style[k];
}
};
// Example 1
document.body.css({
backgroundColor: 'rgb(20,20,20)',
fontFamily: 'Arial, sans-serif',