Skip to content

Instantly share code, notes, and snippets.

>>> from collections import deque
>>> d=deque([1,2,3,4,5])
>>> d
deque([1, 2, 3, 4, 5])
>>> d.rotate(2)
>>> d
deque([4, 5, 1, 2, 3])
>>> d.rotate(-2)
>>> d
deque([1, 2, 3, 4, 5])
s1 = 'hello'
new_dict = dict.fromkeys(s1,1)
@ltoshea
ltoshea / counter.py
Created December 4, 2018 17:27
Counts the number of the same numbers e.g. ar = [10,20,30,40,30] Counter(ar) // {10:1, 20:1, 30:2, 40:1}
from collection import Counter
ar = [10,20,30,40,40]
Counter(ar)
@ltoshea
ltoshea / ColumnHeaderIcons
Created September 27, 2018 08:38
Column Header Icons VUE.JS
columns: [
{
headerName: 'Name',
field: 'name',
icons: {
// menu: '<i class="fas fa-filter"/>'
// menu: '<i class="fa fa-shower"/>'
// filter: '<i class="fa fa-long-arrow-up"/>',
// columns: '<i class="fa fa-snowflake-o"/>',
// sortAscending: '<i class="fa fa-sort-alpha-asc"/>',
@ltoshea
ltoshea / 0_reuse_code.js
Created October 7, 2015 11:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console