Skip to content

Instantly share code, notes, and snippets.

View alexdmejias's full-sized avatar

Alex Mejias alexdmejias

  • Disney Streaming Services
  • New York
View GitHub Profile
@alexdmejias
alexdmejias / media query indicator
Created May 30, 2012 17:50
media query indicator
body::before{
content: "481-767";
font-weight: bold;
display: block;
text-align: center;
background: rgba(255,0,0, 0.5); /* Semi-transparent yellow */
position: absolute;
top: 0;
left: 0;
right: 0;
@alexdmejias
alexdmejias / gist:5348919
Created April 9, 2013 20:06
get the category slug. Use within a category page
function category_slug($print = true) {
$cat = get_category(get_query_var('cat'));
if ($print) {
echo $cat->slug;
} else {
return $cat->slug;
}
}
@alexdmejias
alexdmejias / gist:5348949
Created April 9, 2013 20:08
Get the category slug. use within the category page
function category_id($print = true) {
$cat = get_category(get_query_var('cat'));
if ($print) {
echo $cat->cat_ID;
} else {
return $cat->cat_ID;
}
}
@alexdmejias
alexdmejias / _debug.scss
Created April 9, 2013 21:43
media query debugger. just enable or disable
@mixin debugmessage($message, $color: rgba(255,255,0, 0.9) ){
body::before{
content: $message;
font-weight: bold;
display: block;
text-align: center;
background: #{$color};
position: fixed;
right: 0;
left: 0;
@alexdmejias
alexdmejias / gist:5396091
Created April 16, 2013 13:57
use the same wp-config.php across multiple dev setups
<?php
$domain = $_SERVER[HTTP_HOST];
if ($domain === '') : // If is live enviroment
define('DB_NAME', 'our_live_db');
define('DB_USER', 'our_live_user');
define('DB_PASSWORD', 'our_live_password');
define('DB_HOST', 'localhost');
elseif () : // If is staging enviroment
@alexdmejias
alexdmejias / gist:5396170
Created April 16, 2013 14:06
convert pixel to em - warning I have yet to test it, not 100% on the syntax
@mixin pte($pixels, $context:16) {
@return { $pixels / $context}em;
}
@alexdmejias
alexdmejias / gist:5438088
Created April 22, 2013 20:09
mysql dumpssszs
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
@alexdmejias
alexdmejias / gist:5495337
Created May 1, 2013 13:41
script fallback incase cdn fails
<script src="[url goes here]/jquery-2.0.0.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/js/jquery-2.0.0.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
@alexdmejias
alexdmejias / gist:5673565
Created May 29, 2013 20:29
drupal thing i always seem to need
INSERT INTO node_access
(nid ,gid ,realm ,grant_view, grant_update , grant_delete)
VALUES ( '0', '0', 'all', '1', '0', '0')
@alexdmejias
alexdmejias / gist:7306238
Last active December 27, 2015 09:49
imagemagick cheatsheet
#resize
convert img.gif -resize 64x64 resized_img.gif
# resize image
convert -resize 50% source.png dest.png
# convert from one format to another
convert image.gif image.jpg
#resize