A version of this file also lives at https://github.com/dylan-k/bestrew/blob/master/writers-database_data-model.md
TABLE: Submissions
DESCRIPTION: Each row describes a unique submission
FIELD NAME | DATA TYPE | DESCRIPTION |
---|
<?php | |
/* | |
Snippet Name: Dylan's Post-Metadata Snippet for Wordpress. | |
Description: Shows the date with lots of extra features. the year links to the year, the month to the month, the day to the day. with a plugin, you can also show details like "late in the evening" and "two years ago" | |
Dependencies: | |
http://wordpress.org/plugins/when/ | |
http://wordpress.org/extend/plugins/wp-days-ago/ | |
Usage: | |
I like to store this file in /theme/templates/parts/post-meta.php | |
then i can just do this to bring it up: <?php get_template_part( '/templates/parts/post', 'meta' ); ?> |
A version of this file also lives at https://github.com/dylan-k/bestrew/blob/master/writers-database_data-model.md
TABLE: Submissions
DESCRIPTION: Each row describes a unique submission
FIELD NAME | DATA TYPE | DESCRIPTION |
---|
#A shell script that will rename all the text files in a directory | |
#each file will be named with the first line of text from that file | |
for file in * | |
do | |
# Avoid renaming diretories! | |
if [ -f "$file" ] | |
then | |
newname=`head -1 $file` | |
if [ -f "$newname" ] |
if you have a batch of files and they all have filenames like poem_01 for example, here's a way to add .txt to the end of all those filenames | |
for file in poem_* | |
do | |
mv "$file" "$file.txt" | |
done |
if you want to split one text (or html or similar) file into many, here's a trick:
split -p '^plop' file.txt newfile-
...will split file.txt whenever a line starts with 'plop', into files with names like newfile-a, newfile-b, newfile-c, and so on...
I'd love to get it to create numbered files, instead of lettering them a, b, c for extra credit, I'd love to change the filename to be the first line of text
1) Drop to DOS prompt (Start->Run; cmd) or shift-rightclick to "open cmd prompt here" | |
2) Change to the directory you wish to get a text-based file listing (via cd commands) | |
3) Run “dir *.* /b >fileListing.txt“ | |
/b puts the directory listing into “Bare Mode”– |
<!--Then you will need to locate the following code --> | |
<?php the_modified_time('F jS, Y');?> | |
<!--Note: Since there are so many formats of displaying dates, you might not see the exact code, but something along this line. | |
Replace it with:--> | |
<?php $u_time = get_the_time('U'); | |
$u_modified_time = get_the_modified_time('U'); |
Select the text | |
Press Ctrl + H (or click Find->Replace) | |
Make sure you have selected 'regular expression' (press Alt + R) | |
Find what: ^\n | |
Replace With: (nothing, leave in blank) |
redirect | |
REDIRECT This is some language for use in an .aspx file. It will send a 301 "moved" response and redirect to the location of your choosing. Just change that URL in there to whatever you want. | |
<% | |
Response.Status="301 Moved Permanently" | |
Response.AddHeader ("Location", "http://www.EXAMPLE.com") | |
Response.End() | |
%> | |
...sometimes the URL you're trying to redirect contains a variable. Try something like this |