This file contains 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
package_dir = os.path.abspath(os.path.dirname(__file__)) | |
db_dir = os.path.join(package_dir, 'nd_slack.db') | |
# NEED 4 /'s to specify absolute for sqlalchemy! | |
# ex: sqlite:////asdfaijegoij/aerga.db | |
# NEED 3 /'s for relative paths | |
# path has a / at the beginning so we have 3 here | |
SQLITE_DB = ''.join(['sqlite:///', db_dir]) |
This file contains 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
<img id="first-outfit" | |
srcset="small.jpg 300w, | |
large.jpg 1024w" | |
sizes="(min-width: 768px) 90vw, 100vw" | |
src="medium.jpg" | |
alt="first outfit" /> | |
<!-- srcset defines the image sources and their dimensions --> | |
<!-- sizes defines the breakpoints and what the expected displays are at that break point, no media query is the default value--> | |
<!-- src is the default image when the queries aren't suitably matched/browser does not support srcset --> |
This file contains 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
ctrl-prefix + : respawn-pane -k |
This file contains 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
:set ft=filetype | |
:set relativenumber |
This file contains 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
//not a perfect lazy load as it occurs on the slide event, not prior to the slide itself | |
$(function() { | |
return $("#carousel").on("slide.bs.carousel", function(event) { | |
var lazy; | |
lazy = $(event.relatedTarget).find("img[data-src]"); | |
lazy.attr("src", lazy.data("src")); | |
lazy.removeAttr("data-src"); | |
}); | |
}); |
This file contains 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 -h<hostname> -u<username> -p<password> >output.txt << EOF | |
SELECT table_name, column_name, column_type | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE table_schema='<db_name>' | |
ORDER BY table_name, ordinal_position; | |
EOF |
This file contains 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
# example: dictionary that has students as keys and within each entry has a list of teachers that teach that student | |
# this snippet will use that dictionary to create a dictionary with teachers as keys and within those entires have a list | |
# of students taught by that teacher | |
for e in dic.keys(): | |
for d in dic[e]: | |
if not data.get(d): | |
data[d] = set() | |
data[d].add(e) | |
#simplified |
This file contains 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
for i in list_thing: | |
temp = {} | |
data_obj = i.data | |
if data_obj: | |
data_within = data_obj.get('data1') | |
if data_within: | |
for data in data_within: | |
if data.get('field1') and data.get('field2): | |
temp[data] = helper.function(data_within[data].get('field1'), data_within[data].get('field2') | |
This file contains 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
var blah = '${ c.results_from_query | n}' | |
// | n filter returns them as raw unescaped string, | |
//take care that the string quotes are not the same as the value returned from the server |
This file contains 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
git diff > backup | |
git diff -w > changes (or whatever flag is needed) | |
git reset --hard | |
patch < changes (apply the changes listed in the file) |
NewerOlder