Sometimes you just don’t need this information stored in a database table 😉
Compliments my ISO-3316 Country List 🙂 Continue reading
Sometimes you just don’t need this information stored in a database table 😉
Compliments my ISO-3316 Country List 🙂 Continue reading
Here’s a little bookmarklet I wrote that you can add use automatically collect Zynga rewards while you’re playing games over at Zynga.com. It seems to work for all rewards regardless of which game you’re playing (though I primarily use it for CastleVille).
javascript:var classesPublic='zui_list_itemsContainer zui_zdc_gameboard_rts_rtsList_itemsContainer zui_zdc_gameboard_rts_rtsPublicList_itemsContainer';var classesNeighbors='zui_list_itemsContainer zui_zdc_gameboard_rts_rtsList_itemsContainer zui_zdc_gameboard_rts_rtsNeighborList_itemsContainer';var classesButtons='zui zui_button zui_enabled zui_button_enabled zui_zdc zui_button_zdc zui_zdc_enabled zui_button_zdc_enabled zui_button_tiny zui_button_white';var unclaimedRewardsNeighbors,unclaimedRewardsPublic;var unclaimedNeighborsInit=unclaimedPublicInit=true;function collectRewardsNeighbors(){for(unclaimedIndex=0;unclaimedIndex=1){if(unclaimedNeighborsInit){unclaimedNeighborsInit=false;collectRewardsNeighbors();}else{setTimeout('collectRewardsNeighbors()',1000);}}},false);var parentUnclaimedPublic=document.getElementsByClassName(classesPublic)[0];parentUnclaimedPublic.addEventListener('DOMSubtreeModified',function(){unclaimedRewardsPublic=parentUnclaimedPublic.getElementsByClassName(classesButtons);if(unclaimedRewardsPublic.length>=1){if(unclaimedPublicInit){unclaimedPublicInit=false;collectRewardsPublic();}else{setTimeout('collectRewardsPublic()',1000);}}},false);
What you need to do, is copy the code above and paste it into a new bookmark within your browser. Couldn’t be easier 🙂
Note: This script requires a browser that supports the DOMSubtreeModified – DOM Level 2 Mutation Event (eg: IE9, FF, Safari and Chrome)
Here is a nice confirmation handler to replace javascript:confim() links using jQuery UI…
$(function() { $('.ui-icon-trash').click(function(event){ event.preventDefault(); var targetUrl = $(this).attr('href'); $('<div title="Confirmation Required"><p>Delete this record?</p></div>').dialog({ autoOpen: true, modal: true, resizable: false, buttons: { Yes: function() { window.location.href = targetUrl; }, No: function() { $(this).remove(); } } }); }); });
I use it for “delete” links (should be obvious) but it can be easily adjusted for any other type of confirmation.
Cheers!
For a while I had been wanting to author a generic database table model for CodeIgniter. Here are the results of those efforts… Continue reading
Just a quick reference list for numeric pad key sequences for typing ASCII characters not found on the keyboard.
All you have to do is turn NumLock on, hold the ALT key, type the desired number, then let go of the ALT key. Have fun 😀
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
☺ | ☻ | ♥ | ♦ | ♣ | ♠ | • | ◘ | ○ | ◙ | ♂ | ♀ | ♪ | ♫ | ☼ | ► |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
◄ | ↕ | ‼ | ¶ | § | ▬ | ↨ | ↑ | ↓ | → | ← | ∟ | ↔ | ▲ | ▼ | |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
! | “ | # | $ | % | & | ‘ | ( | ) | * | + | , | – | . | / | 0 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | @ |
65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 |
Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | ` |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |
a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p |
113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 |
q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | ⌂ | Ç |
129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
ü | é | â | ä | à | å | ç | ê | ë | è | ï | î | ì | Ä | Å | É |
145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
æ | Æ | ô | ö | ò | û | ù | ÿ | Ö | Ü | ¢ | £ | ¥ | ₧ | ƒ | á |
161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 |
í | ó | ú | ñ | Ñ | ª | º | ¿ | ⌐ | ¬ | ½ | ¼ | ¡ | « | » | ░ |
177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 |
▒ | ▓ | │ | ┤ | ╡ | ╢ | ╖ | ╕ | ╣ | ║ | ╗ | ╝ | ╜ | ╛ | ┐ | └ |
193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 |
┴ | ┬ | ├ | ─ | ┼ | ╞ | ╟ | ╚ | ╔ | ╩ | ╦ | ╠ | ═ | ╬ | ╧ | ╨ |
209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 |
╤ | ╥ | ╙ | ╘ | ╒ | ╓ | ╫ | ╪ | ┘ | ┌ | █ | ▄ | ▌ | ▐ | ▀ | α |
225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 |
ß | Γ | π | Σ | σ | µ | τ | Φ | Θ | Ω | δ | ∞ | φ | ε | ∩ | ≡ |
241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | |
± | ≥ | ≤ | ⌠ | ⌡ | ÷ | ≈ | ° | ∙ | · | √ | ⁿ | ² | ■ | ||
02222 | 0169 | 0153 | |||||||||||||
® | © | ™ |
Just a quick snippet showing how to force the HTTPS protocol (SSL) and the “www” sub-domain…
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]
There are other ways to achieve the same result, but I find this method is clean and requires the least amount of overhead to incorporate.
Just a quick snippet that I used today to find all files/folders with specific permissions in a directory before moving a site from a development server to a production environment…
ls -Rl | grep -i 'rwxrwxrwx'
Note: The example above looks for all files and directories with maxed out (eg: 0777) permissions 😉
I had a problem where CodeIgniter sessions stored in the database were creating multiple session_id’s (each time the session library was called) for the same user.
Here is how my session configuration is defined…
$config['sess_cookie_name'] = 'my-session'; $config['sess_expiration'] = 60*60*2; //2 hours $config['sess_expire_on_close'] = TRUE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = TRUE; $config['sess_table_name'] = 'sessions'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300;
Here is the updated table structure…
CREATE TABLE IF NOT EXISTS `sessions` ( `session_id` varchar(32) NOT NULL default '0', `ip_address` varchar(16) NOT NULL default '0', `user_agent` varchar(255) NOT NULL, `last_activity` int(10) unsigned NOT NULL default '0', `user_data` text NOT NULL, PRIMARY KEY (`session_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
My solution… First, I increased the user_agent field to 255 characters in length. Then, since session_id is always 32 characters in length, I reduced that from 40. If you have any other suggestions, feel free to leave a comment.
Hope this helps someone else having the same problem with CodeIgniter sessions that are being stored in the database 🙂
Here is a quick snippet to pulls the month and year from any date field in a MySQL table…
SELECT DATE_FORMAT(date_added, '%b %Y') AS sDate, COUNT(post_id) AS iCount FROM blog_posts GROUP BY sDate ORDER BY sDate DESC
sDate | iCount |
---|---|
Jan 2012 | 4 |
Dec 2011 | 16 |
Nov 2011 | 0 |
Oct 2011 | 12 |
Mostly for my reference, but hope it helps someone else 😉
Just a quote note in case I need to find it again later…
If you forgot your admin password for Gallery3 by Menalto, open the users table via phpMyAdmin and replace the existing encrypted password with the following.
$P$DyhWrqfmMF/XKPf3CtPn0pIQDZpQKu
Now, you can log in using 12345 as the password. Make sure you change this immediately after logging back in!
If you came here looking for the code, that will be a bit further down the road. Here is the plan…
Take this…
Note: The above screen has my hide offline users mod applied 😉
And make it look more like this…
This is a “for fun” project and will be completed as time permits. So check back soon for progress updates.