Skip to content

Instantly share code, notes, and snippets.

View le-dawg's full-sized avatar
👁️
I may be slow to respond.

dawg le-dawg

👁️
I may be slow to respond.
View GitHub Profile
@le-dawg
le-dawg / gist:7adce5a18ae31dcd057da4f5c7c750cc
Created February 13, 2018 18:07
[Wordpress, X Theme, Cornerstone] Close Accordion Element on load
//This snippet is a very short jQuery function that is executed when the javascript is exectued on load.
// Troubleshooting:
// You might want to add a specific class to the accordion element itself and then append that to the first div: ('div#accordionID > ...
jQuery(function(){
jQuery('div > div.x-accordion-heading > a.x-accordion-toggle').click();
});
@le-dawg
le-dawg / init2dlist.py
Created June 25, 2017 21:13
Easily initialize 2D list
    # Rapidly initalize 2D list
2dlist = [[0] * 3 for i in xrange(3)]
print(2dlist)
# [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
@le-dawg
le-dawg / PandasSnippets.py
Created June 25, 2017 21:09
Python / Pandas snippets for the troubleshooting developer pt.1
  #Count occurences of string in dataframe
  #Check how many rows in DataFrame contain certain substring s in column col
print(len(df[df['col'].str.contains("s")].index.values[:]))
 
#Index of columns in dataframe containing string
#Get indices of rows that contain substring s in column col
print(df[df['col'].str.contains("s")].index.values[:])