Skip to content

Instantly share code, notes, and snippets.

View PaulGwamanda's full-sized avatar
💭
Leave the world a little better than you found it

Paul Gwamanda PaulGwamanda

💭
Leave the world a little better than you found it
View GitHub Profile
@PaulGwamanda
PaulGwamanda / Material_design_ripple_click_effect .js
Created March 17, 2018 12:16
Material design ripple click effect
<style>
a {
position: relative;
transition: all 0.2s ease;
}
.ink {
display: inline-block;
position: absolute;
background: rgba(155, 155, 155, 0.3);
@PaulGwamanda
PaulGwamanda / MS-DOS_script_for_creating_files_from_an_array
Created May 30, 2018 12:54
MS-DOS script for creating files from an array
MS-DOS script for creating files (any extension) from an array in a text document.
ie: 'filenames.txt' document contains below list of items:
file-1.html
file-2.html
file-3.html
file-4.html
file-5.html
Open MS-DOS in same folder and run below script
@PaulGwamanda
PaulGwamanda / Convert_images_to_numpy_arrays_in_python.py
Created July 3, 2018 09:51
Convert images to numpy arrays in python
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import shutil
import numpy as np
CONTEXT_LENGTH = 48
@PaulGwamanda
PaulGwamanda / ExamineSettings.config
Created August 20, 2018 12:54
Umbraco examine indexer for search engine
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to add your own search/index providers.
Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.
More information and documentation can be found on GitHub: https://github.com/Shazwazza/Examine/
-->
<Examine>
<ExamineIndexProviders>
@PaulGwamanda
PaulGwamanda / ExamineIndex.config
Created August 20, 2018 12:55
Examine Index/Search providers for site search, can defined in the UmbracoSettings.config
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to create your own index sets.
Index/Search providers can be defined in the UmbracoSettings.config
More information and documentation can be found on GitHub: https://github.com/Shazwazza/Examine/
-->
<ExamineLuceneIndexSets>
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
@PaulGwamanda
PaulGwamanda / Fix object fit cover for IE
Created September 20, 2018 12:03
Fix object fit cover for IE
Fix object fit cover for IE
$('.card-with-image img').each(function () {
var t = $(this),
s = 'url(' + t.attr('src') + ')',
p = t.parent();
t.hide();
if (p.has('img')) {
p.css({
@PaulGwamanda
PaulGwamanda / WP_Query_Columns.php
Last active October 3, 2018 11:06
How to split a loop into multiple columns - WP_Query_Columns - Columns for the loop. - http://wordpress.stackexchange.com/q/9308/178
// How to split a wordpress bootstrap loop into multiple columns
/** This goes into template **/
<?php $the_query = new WP_Query('cat=1&showposts=50&orderby=title&order=asc');?>
<?php foreach(new WP_Query_Columns($the_query, 10) as $column_count) : ?>
<ul>
<?php while ($column_count--) : $the_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
@PaulGwamanda
PaulGwamanda / related-posts.php
Last active October 4, 2018 12:56
Wordpress related posts
@PaulGwamanda
PaulGwamanda / png_to_numpy_array.py
Created October 11, 2018 08:37
Convert PNG images to numpy array (NPZ) for machine learning
from __future__ import print_function
from __future__ import absolute_import
from distutils.dir_util import copy_tree
import os
import sys
import glob
import json
import re
import shutil
@PaulGwamanda
PaulGwamanda / findReplace.py
Created October 12, 2018 10:46
Python program to find replace and clean files in directory
def findReplace(directory, find, replace, filePattern):
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, filePattern):
filepath = os.path.join(path, filename)
with open(filepath) as f:
s = f.read()
s = s.replace(find, replace)
with open(filepath, "w") as f:
f.write(s)
MYPATH = "folder/folder"