Skip to content

Instantly share code, notes, and snippets.

View ilyaashapatov's full-sized avatar
🏠
Working from Sber

Ilya Ashapatov ilyaashapatov

🏠
Working from Sber
View GitHub Profile
@hayahyts
hayahyts / ViewController.swift
Last active November 2, 2023 01:45
How to prevent WKWebView to repeatedly ask for permission to access location?
import UIKit
import WebKit
import CoreLocation
class ViewController: UIViewController , CLLocationManagerDelegate, WKScriptMessageHandler{
var webView: WKWebView?
var manager: CLLocationManager!
override func viewDidLoad() {
super.viewDidLoad()
@novemberfiveco-gists
novemberfiveco-gists / WKCookieWebView.swift
Last active June 26, 2023 10:02
A WKWebView subclass that passes cookies after a 302 redirect response.
//
// WKCookieWebView.swift
//
// Created by Jens Reynders on 30/03/2018.
// Copyright (c) 2018 November Five
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@cmourouvin
cmourouvin / start-portainer.sh
Last active August 20, 2020 17:39
Start portainer UI for manage your local docker install
# From http://portainer.io/
# Mac and Linux only
docker run -it -name porteiner-ui -v "/var/run/docker.sock:/var/run/docker.sock" -p 9000:9000 portainer/portainer
# Open portainer in a web browser
google-chrome http://localhost:9000
# Enter a password and login => ENjoy :)
# Manager images, containers lifecycle
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@frederikchristensen
frederikchristensen / gulpfile.coffee
Last active August 29, 2015 14:00
My current Gulp build. Check out the quick recipe for using CoffeeScript for your gulpfile here: https://github.com/gulpjs/gulp/blob/master/docs/recipes/using-coffee-script-for-gulpfile.md
# Load plugins
gulp = require("gulp")
stylus = require("gulp-stylus")
minifycss = require("gulp-minify-css")
coffee = require("gulp-coffee")
uglify = require("gulp-uglify")
imagemin = require("gulp-imagemin")
rename = require("gulp-rename")
clean = require("gulp-clean")
concat = require("gulp-concat")
// getCookie(), setCookie(), deleteCookie()
// возвращает cookie если есть или undefined
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
@saippuakauppias
saippuakauppias / gist:3430432
Last active December 28, 2021 02:51
git shortcuts + zshrc
function git_current_branch () {
local ref
ref="$(git symbolic-ref --quiet HEAD 2>/dev/null)"
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return 0
ref=$(git rev-parse --short HEAD 2>/dev/null) || return 0
fi
echo "${ref#refs/heads/}"
@craigmdennis
craigmdennis / gallery.bxslider.html
Created November 1, 2011 16:48
A BX Slider configuration that uses 2 separate sliders. One for the gallery and one for the thumbs.