What do you want to save?
Add Code snippet
New code examples
-
Swift 2021-08-27 20:10:02
how to get index path cell collection view from ui longpress gesture swift
private func setupLongGestureRecognizerOnCollection() { let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress(gestureRecognizer:))) longPressedGesture.minimumPressDuration = 0.5 longPressedGestur... Add solution -
Python 2021-08-27 19:37:01
networkx remove nodes with degree
import networkx G1 = networkx.Graph() G1.add_edges_from([('a','b'),('b','c'),('c','e'),('c','d'),('c','f'),('c','g')]) to_be_removed = [x for x in G1.nodes() if G1.degree(x) <= 1] for x in to_be_removed: G1.remove_node(x) print(G1.edges()) Add solution -
Other 2021-08-27 19:34:02
apiipify
# This example requires the requests library be installed. You can learn more # about the Requests library here: http://docs.python-requests.org/en/latest/ from requests import get ip = get('https://api.ipify.org').text print('My public IP address is: {... Add solution -
Python 2021-08-27 18:01:01
fibonacci series for loop python
# WARNING: this program assumes the # fibonacci sequence starts at 1 def fib(num): """return the number at index `num` in the fibonacci sequence""" if num <= 2: return 1 return fib(num - 1) + fib(num - 2) ... Add solution -
SQL 2021-08-27 17:15:02
connect to sql server with python
import pyodbc # Some other example server values are # server = 'localhost\sqlexpress' # for a named instance # server = 'myserver,port' # to specify an alternate port server = 'tcp:myserver.database.windows.net' database = 'mydb' username = 'myusernam... Add solution -
Python 2021-08-27 16:32:01
python import filenames that match search
# Basic syntax: glob.glob('/directory/to/search/search_pattern') # Where the search_pattern follows the Unix path expansion rules # Example usage: # Say you have a directory containing the following files and you only # want to get the filenames ending ... Add solution