Skip to content

Instantly share code, notes, and snippets.

View dylan-k's full-sized avatar

Dylan Kinnett dylan-k

View GitHub Profile
@dylan-k
dylan-k / css-media-queries.css
Last active April 23, 2021 18:43
This is an empty CSS file that contains media queries. Replace /*...*/ blocks with ordinary css, to have that css applied to specific screen sizes.#
/* Large desktop */
@media (min-width: 1200px) { /*...*/ }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { /*...*/ }
/* Landscape phone to portrait tablet */
@media (max-width: 767px) { /*...*/ }
/* Landscape phones and down */
@dylan-k
dylan-k / redirect.aspx
Last active February 1, 2016 21:08
Redirect
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
@dylan-k
dylan-k / delete-blank-lines
Created August 1, 2013 19:08
Sublime Text 2: How to delete blank/empty lines
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)
@dylan-k
dylan-k / display-modified-time.php
Created August 1, 2013 21:09
Wordpress: Display Modified Time For example, if you posted an article on July 19, 2009, and you found out three days later that there was an update to the story. You can just edit the article, and it will show July 22, 2009 at the timestamp for last update. First you need to open these three files: index.php single.php page.php
<!--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');
@dylan-k
dylan-k / filenames.txt
Created September 1, 2013 01:36
use windows command prompt to generate a list of filenames
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”–
@dylan-k
dylan-k / splitfiles.md
Last active December 22, 2015 19:09
split one text file into many

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

@dylan-k
dylan-k / batch-suffix
Created September 11, 2013 01:38
add .txt suffix to a batch of files
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
@dylan-k
dylan-k / filename-firstline.sh
Created September 12, 2013 00:55
rename each text file according to its first line of text
#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" ]
@dylan-k
dylan-k / git-subset-branch.log
Last active December 24, 2015 08:29 — forked from vasi/gist:6695286
This is one way to work with a subset of files, within a Git Branch. See also: http://ask.metafilter.com/249100/Can-a-Git-Branch-Contain-Only-a-Sub-Set-of-the-Repository#3617407
# (on master)
git checkout -b subset
git rm file1.txt file2.txt # (remove the files you don't want on this branch)
git commit -m 'removed some stuff'
git checkout master # (go back to master)
git merge --strategy ours subset # (record a merge from the subset branch, but make no actual changes to master)
git checkout subset
# (edit file3.txt)
git add file3.txt
git commit -m 'edited file3'
@dylan-k
dylan-k / writers-database_data-model.md
Last active December 24, 2015 23:19
database design for writer's database