This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_dashboard_widgets() { | |
// Globalize the metaboxes array, this holds all the widgets for wp-admin | |
global $wp_meta_boxes; | |
// Remove the incomming links widget | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); | |
// Remove right now | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); | |
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); | |
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth ) { | |
// load image and get image size | |
$img = imagecreatefromjpeg( "{$pathToImages}" ); | |
$width = imagesx( $img ); | |
$height = imagesy( $img ); | |
// calculate thumbnail size | |
$new_width = $thumbWidth; | |
$new_height = floor( $height * ( $thumbWidth / $width ) ); | |
// create a new temporary image | |
$tmp_img = imagecreatetruecolor( $new_width, $new_height ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s3_uploading ($flname, $vid, $cover) { | |
if($_FILES[$flname]["name"]) { | |
$photodir; | |
try { | |
if ((($_FILES[$flname]["type"] == "image/gif") || ($_FILES[$flname]["type"] == "image/jpg") || ($_FILES[$flname]["type"] == "image/jpeg") || ($_FILES[$flname]["type"] == "image/pjpeg")) && ($_FILES[$flname]["size"] < 1000000)) { | |
if ($_FILES[$flname]["error"] > 0) { | |
echo "Return Code: " . $_FILES[$flname]["error"] . "<br />"; | |
} | |
else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_theme_support('menus'); | |
register_sidebar( | |
array( | |
'before_widget' => '<div class="widget">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3>', | |
'after_title' => '</h3>', | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(strlen($array['option']) > 0) { | |
$optLen = strlen($array['option']); | |
$optionBit = $array['option']; | |
$strSql = "SELECT ".$wpdb->prefix."option . * FROM ".$wpdb->prefix."option ORDER BY ".$wpdb->prefix."option.option_id"; | |
$wpdb->query($strSql); | |
$options = $wpdb->get_results($strSql,ARRAY_A); | |
if(count($options) > 0) { | |
$retNo = 0; | |
$i = 0; | |
foreach((array)$options as $option) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u [username] -p [database_name] < [dumpfilename.sql] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Override the class name in the form_for helper. | |
<%= form_for("model", :url => model_action_path, :html => { :class => "form-horizontal" } ) do |f| %> | |
keep checkbox and label on same line. | |
:class => "checkbox inline" to label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\c db_name : to connect to a certain database | |
\l : lists all databases | |
\dt : lists all tables in the current database | |
\d+ tablename : display table schema | |
heroku pg:psql : connect to Heroku psql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/app/helpers/devise_helper.rb | |
module DeviseHelper | |
def devise_error_messages! | |
return '' if resource.errors.empty? | |
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t('errors.messages.not_saved', | |
count: resource.errors.count, | |
resource: resource.class.model_name.human.downcase) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { //noconflict wrapper | |
$('input#submit').addClass('btn btn-info'); | |
});//end noconflict |