Skip to content

Instantly share code, notes, and snippets.

@joshcangit
joshcangit / folder-import.php
Last active May 21, 2023 09:08
Import .sql database files from a folder into Adminer.
<?php
/**
* Import SQL files from a directory
*
* @author joshcangit, https://github.com/joshcangit
* @author Roy-Orbison, https://github.com/Roy-Orbison
*/
class AdminerImportFromFolder {
@Jiab77
Jiab77 / migrate-from-php-to-python.md
Last active December 21, 2023 09:31
Migrate from PHP to Python

Migrate from PHP to Python

Hi all, recently I've decided to move on and learn Python programming. At first, I though that it would be very difficult but in fact... Not that much. So I've decided to write this little gist and show the main differences between both languages.

I will use try to follow the same order used on this website: https://pythonprogramming.net/introduction-to-python-programming/. It was really usefull to improve my understanding of Python programming.

To finish, I'm assuming that you already got basic knowledge in Object Oriented Programming and already got skills and understanding of PHP programming. This is not intended to explain you how to code in PHP but if you're coming from Python programming, then this gist might help you to migrate from Python to PHP.

Official documentations

@terrywbrady
terrywbrady / Mirage2Theme.xsl
Last active December 13, 2023 09:46
DSpace / IIIF Integration for DigitalGeorgetown
<!--
The following XSL lives in a top-level theme xsl file.
This block of code controls all of loose integrations that we have embedded in our custom themes.
Since our work with IIIF is still evolving, we offer a number of mechanisms for linking a IIIF manifest into DSpace
- Add the manifest file as a specially named item bitstream ("IIIF Manifest")
- Link a manifest to an item in dc.relation.uri
- Link a manifest file to a collection page with special markup in dc.description.tableofcontents
We expect to eventually standardize the integration on a smaller set of options.
@tommyready
tommyready / dbcopier.py
Created October 16, 2017 17:49
Using Python to dump a Mysql database and import into another Mysql database
#!/usr/bin/env python
import ConfigParser
import os
import time
import getpass
def combine_files(self,file1,file2):
with open('file1', 'w') as outfile:
with open(file2) as infile:
@trafficinc
trafficinc / dbbackup.py
Last active March 8, 2024 04:26
Python script for taking mysqldump
#!/usr/local/bin/python3
"""
Will backup all the databases listed, will put files in same DIR as script'
To run: $ python dbbackup.py OR python3 dbbackup.py
"""
import configparser
import os
import time
@rodmcnew
rodmcnew / iframe-killa.js
Last active March 2, 2022 23:07
This is a bookmarklet that removes all iframes from the current page. Paste its code into a bookmark URL field. Click the bookmark to remove all iframes. Once started, it also removes newly spawned iframes every 100ms.
javascript:void(function(){setInterval(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})},100)}());
@perliedman
perliedman / click-through-layers.js
Created March 7, 2017 15:11
Click through multiple layers of Leaflet VectorGrid
// Since overlays are VectorGrid layers with canvas rendering,
// they don't support clicking through them (the topmost canvas
// swallows the event, lower layers will not see it).
// We workaround this by this hack (inspired by
// http://www.vinylfox.com/forwarding-mouse-events-through-layers/):
//
// All overlays are in their own Leaflet pane. When a click hits a
// layer in the pane, we first handle the event like normal, and then
// hit the event handler below this comment.
//
@reinvented
reinvented / camino-with-waypoints.geojson
Last active April 27, 2020 19:18
Camino Frances walking route with overnight waypoints
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BlueNexus
BlueNexus / python2pseudo.py
Last active April 21, 2024 23:25
Python to Pseudocode converter
import os.path
import re
'''
INSTRUCTIONS
1. Create a file with the following code
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py"
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =),
as the program cannot handle these convincingly
4. Run the converter file
@hasibomi
hasibomi / changeurl.js
Last active July 20, 2023 22:47
Change URL in Browser Address Bar without reloading using JavaScript and jQuery
/* The solution found here: http://www.aspsnippets.com/Articles/Change-URL-in-Browser-Address-Bar-without-reloading-using-JavaScript-and-jQuery.aspx */
/** HTML5 History pushState method
* The pushState method works similar to window.location but it does not refresh or reload the page and it will modify the URL even if the page does not exists. The pushState method actually inserts an entry into the history of the browsers which allows us to go back and forth using the browser’s forward and back buttons.
* The pushState method accepts the following three parameters.
* 1. State object: - The state object is a JavaScript object which can contain any details about the page and must be serializable.
* 2. Title: - The title of the page.
* 3. URL – The URL of the page.
*/