Skip to content

Instantly share code, notes, and snippets.

View Leksat's full-sized avatar

Alexander Tkachev Leksat

View GitHub Profile
[
{
"provider_name": "YouTube",
"provider_url": "https://www.youtube.com/",
"endpoints": [
{
"schemes": [
"https://*.youtube.com/watch*",
"https://*.youtube.com/v/*",
"https://youtu.be/*"
@Leksat
Leksat / copy.js
Last active May 23, 2023 09:44
Copy bookmarklet for Jira
javascript:(function(){
const ticketNumber =
/* If we are on a Jira board. */
location.search.match('[?&]selectedIssue=(.*?)([&]|$)')?.[1] ||
/* If we are on the ticket page. */
location.pathname.split('/').pop();
const ticketSummary = document.getElementsByTagName('h1')[document.getElementsByTagName('h1').length-1].textContent.trim();
const ticketUrl = `${location.origin}/browse/${ticketNumber}`;
const html = `<a href="${ticketUrl}">${ticketNumber} [${ticketSummary}]</a>`;
const text = `[${ticketNumber} ${ticketSummary}](${ticketUrl})`;
@Leksat
Leksat / README.md
Last active February 14, 2019 22:02 — forked from joyrexus/README.md
collapsible markdown
Clsfgy dftyylll some text E some text
@Leksat
Leksat / test.md
Last active January 31, 2019 12:56

asd \ asd`

asd `` asd

asd ` asd

@Leksat
Leksat / Composer JS libraries example.diff
Created April 26, 2017 08:03
In this example we add masonry, imagesloaded, and dropzone libraries to Composer.
diff --git a/.gitignore b/.gitignore
index fc00ed5..ac82bec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ web/core
web/modules/contrib
web/themes/contrib
web/profiles/contrib
+web/libraries
@Leksat
Leksat / gist:815dcc153b4650b321ab
Created July 3, 2015 14:31
Drupal 8 custom entity type
Target: custom entity type, not config entity, nor content entity
# implementation 1:
- entity: EntityInterface
- storage: EntityStorageInterface
- query service:
- QueryFactoryInterface
- QueryInterface
- ConditionInterface
# implementation 2:
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$t = '/Users/alex/outgoing_mails/' . date('Y-m-d_H-i-s') . '---' . $matches[1] . '---' . uniqid() . '.eml';
file_put_contents($t, $input);
chmod($t, 0666);
@Leksat
Leksat / gist:4245cda7b3f6d1d4c2f8
Created June 7, 2014 09:02
drupal, union, count query, pagerdefault
solution: https://drupal.org/node/1145076#comment-7673535
@Leksat
Leksat / 0_reuse_code.js
Created January 22, 2014 09: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
@Leksat
Leksat / time_tracker.dart
Created November 19, 2012 19:14
Task creation before switching to web components.
Task(this.timeTracker, [this.name = '', this.seconds = 0]) {
// copy task from template
taskDiv = document.query('#task-template').clone(true);
taskDiv.attributes.remove('id');
// init inputs
nameInput = taskDiv.query('.name');
timeInput = taskDiv.query('.time');
nameInput.value = name;
timeInput.value = formatTimeString(seconds);