Skip to content

Instantly share code, notes, and snippets.

View XBeg9's full-sized avatar
🎯
Working hard

Fedir Skitsko XBeg9

🎯
Working hard
View GitHub Profile
const Page = require('puppeteer/lib/Page');
// the following 2 methods are originally from: https://github.com/GoogleChrome/puppeteer/issues/85#issuecomment-341743259, with some modification to fit puppeteerv1.0.0
async function newPageWithNewContext(browser) {
const { browserContextId } = await browser._connection.send('Target.createBrowserContext');
const { targetId } = await browser._connection.send('Target.createTarget', { url: 'about:blank', browserContextId });
const target = await browser._targets.get(targetId);
const client = await browser._connection.createSession(targetId);
const page = await Page.create(client, target, browser._ignoreHTTPSErrors, browser._appMode, browser._screenshotTaskQueue);
page.browserContextId = browserContextId;
@danilvalov
danilvalov / config.yml
Last active February 18, 2021 18:36
FlexGet Kinopoisk plugin
templates:
movies:
set:
path: /tmp/mnt/94E8B2B1E8B290CA/Torrents/download/DLNA/Movies
transmission:
host: ************
port: ****
username: *************
password: *************
email:
@yoichitgy
yoichitgy / mergegenstrings.py
Last active July 9, 2022 23:59
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@viteinfinite
viteinfinite / nsspain2014-slides.md
Last active April 26, 2016 06:28
NSSpain 2014 Slides
@ijoshsmith
ijoshsmith / marshalMadness.swift
Created July 9, 2014 18:17
Having some fun with the marshal operator in Swift
import UIKit
// The marshal operator is reviewed in this blog post…
// http://ijoshsmith.com/2014/07/05/custom-threading-operator-in-swift/
// Don't ever do something this ridiculous in a real app!
func printMarshalOperator()
{
{p("M")}
@calebd
calebd / AsynchronousOperation.swift
Last active February 27, 2025 09:17
Concurrent NSOperation in Swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class AsynchronousOperation: Operation {
// MARK: - Properties
@staltz
staltz / introrx.md
Last active April 21, 2025 04:15
The introduction to Reactive Programming you've been missing
@calebd
calebd / ArrayHelpers.swift
Last active January 29, 2025 06:05
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@mdznr
mdznr / Switch
Last active August 29, 2015 14:02
The way switch statements work is different in Swift than in other languages, like C.
var total : Int
let myString = "foo"
// When originally looking at Swift's switch statements, you may think this is how you get fall through behaviour:
total = 0
switch myString {
case "foo":
total += 4
case "foo", "bar":
total += 2
@steventroughtonsmith
steventroughtonsmith / HWKViewController.m
Last active May 31, 2020 23:55
Example of dynamic iOS UI that changes based on the connection/disconnection of a hardware keyboard, based on suggestions from @JohnRHeaton. Requires linking to private GraphicsServices framework. rdar://problem/15447952
//
// HWKViewController.m
// HardwareKeyboardUI
//
// Created by Steven Troughton-Smith on 13/11/2013.
// Copyright (c) 2013 High Caffeine Content. All rights reserved.
//
#import "HWKViewController.h"