Skip to content

Instantly share code, notes, and snippets.

View Scvairy's full-sized avatar

Timur Sharifyanov Scvairy

View GitHub Profile
@davletyarov
davletyarov / result_modifier.php
Last active June 28, 2019 10:02
Косвенный result_modifier.php
<?php
defined('B_PROLOG_INCLUDED') || die();
/**
* @global CMain $APPLICATION
* @var array $arParams
* @var array $arResult
*/
// зеркально указываем оригинальное место нахождение директори шаблона, которую мы хотим расширить косвенно
$this->__folder = '/bitrix/components/bitrix/crm.interface.filter/templates/flat';
@subhojit777
subhojit777 / prepare-commit-msg.sh
Last active October 14, 2020 12:57 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# JIRA branch name - JIRAPRJ-777-short-desc
# Prepended commit message - JIRAPRJ-777:<space>
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
@beny
beny / gist:8313959
Last active March 14, 2022 11:41
Xcode tips

Core Data

  • -com.apple.CoreData.SQLDebug 1-3 - print all SQL queries called by Core Data
    • -com.apple.CoreData.Logging.stderr 1-3 - needed alongside with the SQLDebug from iOS 10+ because of new logging system, more on that in changelog
  • -com.apple.CoreData.SyntaxtColoredLogging YES - probably syntax colored logging (not tried)
  • -com.apple.CoreData.SQLiteDebugSynchronous 1 - preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details
  • -com.apple.CoreData.SQLiteIntegrityCheck 1 - the SQLite store does extra integrity checking
  • -com.apple.CoreData.MigrationDebug 1 - Core Data will log information about exceptional cases as it migrates data
  • -com.apple.CoreData.ThreadingDebug - preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where incre
@wishfoundry
wishfoundry / gist:7036457
Last active April 1, 2022 05:18
Set OSX default text editor to sublime text 3 instead of TextEdit
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
var obj = JSON.parse($response.body);
obj= {
"purchases": [
{
"topUpId": "iapPremiumYearly70FreeTrial",
"provider": "apple",
"receipt": "MIIULAYJKoZIhvcNAQcCoIIUHTCCFBkCAQExCzAJBgUrDgMCGgUAMIIDzQYJKoZIhvcNAQcBoIIDvgSCA7oxggO2MAoCARQCAQEEAgwAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMAwCAQ4CAQEEBAICAIkwDQIBCwIBAQQFAgMTIfwwDQIBDQIBAQQFAgMB1YgwDgIBAQIBAQQGAgQ4AD+TMA4CAQkCAQEEBgIEUDI1MjAOAgEQAgEBBAYCBDGIVhowEAIBDwIBAQQIAgZVhlh8FGUwEQIBAwIBAQQJDAczMS4xMi4wMBECARMCAQEECQwHMzEuMTIuMDAUAgEAAgEBBAwMClByb2R1Y3Rpb24wGAIBBAIBAgQQthX8KtETb7VYNLeOXqvzgDAcAgEFAgEBBBQF7usNDLV6JkGwLKjs5MYNIo3bTjAeAgEIAgEBBBYWFDIwMTktMDQtMjFUMTg6Mjg6NTlaMB4CAQwCAQEEFhYUMjAxOS0wNC0yMVQxODoyODo1OVowHgIBEgIBAQQWFhQyMDE5LTA0LTIxVDE3OjU5OjM3WjAlAgECAgEBBB0MG2NvbS5wbGFuYmxhYnMuZHJvcHMuaXRhbGlhbjBGAgEHAgEBBD5KvFdEpBoIn92kAmekzisa7LgVEfTLEFvYGOpK5aRsW4i70RzYl9vlpDFd1iF7Gft3wEjeSBnjBaDfyRpHajBIAgEGAgEBBEBaSa7eVaPTsa1hSAKuIqu8z5KlH/VpRatbPKSkorwXo8ewSCIBlBQFVgcoVfPpeWJdpNEnbQg8Rba1Jj+SMywgMIIBkAIBEQIBAQSCAYYxggGCMAsCAgatAgEBBAIMADALAg
@foxicode
foxicode / String+subscript.swift
Created February 22, 2020 10:29
Swift String subscript extension
import Foundation
extension String {
subscript (i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
subscript (bounds: CountableRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
#!/bin/sh
grep pam_tid /etc/pam.d/sudo >/dev/null || echo auth sufficient pam_tid.so | cat - /etc/pam.d/sudo | sudo tee /etc/pam.d/sudo > /dev/null
@zats
zats / REMAP_M1_KEYS.MD
Last active December 23, 2023 20:32
Apple M1 MacBook Do Not Disturb Key remapping

Following is a sample of LaungAgent that remaps do not disturb key to Siri (I am using Type to Siri)

This is a lightweight solution not relying on external apps.

Setting up

  1. Create ~/Library/LaunchAgents/com.local.KeyRemapping.plist
  2. Edit it to have following content
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active March 20, 2024 08:12
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@emotality
emotality / duplicate_line_xcode.md
Last active April 6, 2024 04:23
Xcode - Duplicate Line key binding

NOTE (2022-07-09): Xcode finally added this functionality in Xcode 14, please see release notes here:

New Features in Xcode 14 Beta 3
When editing code, the Edit > Duplicate menu item and its corresponding keyboard shortcut now duplicate the selected text — or the line that currently contains the insertion point, if no text is selected. (8614499) (FB5618491)


Xcode line duplicate

Bind keys to duplicate lines in Xcode