Skip to content

Instantly share code, notes, and snippets.

View xtools-at's full-sized avatar

Martin xtools-at

View GitHub Profile
@eligrey
eligrey / insertAdjacentHTML.js
Created October 10, 2011 18:06
insertAdjacentHTML polyfill
/*
* insertAdjacentHTML.js
* Cross-browser full HTMLElement.insertAdjacentHTML implementation.
*
* 2011-10-10
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@ronkorving
ronkorving / ios6-timers.js
Last active March 9, 2022 03:40
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is released in the public domain. Do with it what you want, without limitations. I do not promise
// that it works, or that I will provide support (don't sue me).
// Author: [email protected]
var timeouts = {};
@Tasssadar
Tasssadar / mako-aosp-Implement-kexec-hardboot.patch
Last active January 7, 2022 17:10
kexec-hardboot for LG Nexus 4 (mako)
From a5c71c50da839c6932af1903bcc0036daa033f7e Mon Sep 17 00:00:00 2001
From: Vojtech Bocek <[email protected]>
Date: Mon, 30 Sep 2013 18:02:43 +0200
Subject: [PATCH] Implement kexec-hardboot
"Allows hard booting (i.e., with a full hardware reboot) to a kernel
previously loaded in memory by kexec. This works around the problem of
soft-booted kernel hangs due to improper device shutdown and/or
reinitialization."
More info in /arch/arm/Kconfig.
@bojan
bojan / .gitignore
Last active August 8, 2022 07:43
Git ignore file for development on Apple platforms. Covers Xcode, AppCode, SPM, Carthage, CocoaPods, Fastlane, etc.
# --------------------------------
# macOS temporary files
# --------------------------------
.DS_Store
*.lock
*.swp
# --------------------------------
# Xcode
# --------------------------------
@vyatri
vyatri / inside_controller.js
Created March 20, 2014 10:14
How to center ImageView inside ScrollView in Titanium. A way to "automatically" centering image inside scrollview for automatic center cropping or thumbnailing purpose. If you use this for model-view binding, simply put this controller script inside filter function
$.bar.addEventListener("load",function(e){ // because the image in $.bar is remote
// check orientasi
var h = $.bar.rect.height, w = $.bar.rect.width, a = w/h;
var ch = $.foo.rect.height, cw = $.foo.rect.width, ac = cw/ch; // container
if(a > ac){
$.foo.contentHeight = "100%";
$.bar.left = (w - cw)/2*-1;
} else if(a < ac){
$.foo.contentWidth = "100%";
$.bar.top = ((cw/a)-ch)/2*-1;
@panzi
panzi / expand_patterns.js
Last active June 18, 2017 12:31
Static share links template.
// expand {{PATTERNS}}
// You can do this serverside. I just did it this way for demonstration purposes.
(function () {
"use strict";
var shares = document.querySelectorAll("ul.share > li > a");
var keywords = document.querySelector('meta[name=keywords]').getAttribute("content");
var description = document.querySelector('meta[name=description]').getAttribute("content");
var params = {
URL: encodeURIComponent(document.querySelector('link[rel=canonical]').getAttribute("href")),
@soheilhy
soheilhy / nginxproxy.md
Last active October 23, 2024 08:19
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@alexwilson
alexwilson / cloudflare-challenge.js
Last active September 3, 2021 17:23
This is a project designed to get around sites using Cloudflare's "I'm under attack" mode. Using the PhantomJS headless browser, it queries a site given to it as the second parameter, waits six seconds and returns the cookies required to continue using this site. With this, it is possible to automate scrapers or spiders that would otherwise be t…
/**
* This is a project designed to get around sites using Cloudflare's "I'm under attack" mode.
* Using the PhantomJS headless browser, it queries a site given to it as the second parameter,
* waits six seconds and returns the cookies required to continue using this site. With this,
* it is possible to automate scrapers or spiders that would otherwise be thwarted by Cloudflare's
* anti-bot protection.
*
* To run this: phantomjs cloudflare-challenge.js http://www.example.org/
*
* Copyright © 2015 by Alex Wilson <[email protected]>
@milanaryal
milanaryal / schema-org-structured-data-markup-using-microdata.html
Last active October 8, 2024 15:22
An example of how to mark up a HTML5 webpage using the schema.org schemas and microdata.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Site Title</title>
<link rel="stylesheet" href="/assets/css/style.min.css">
@timaschew
timaschew / gulp-task.js
Last active December 4, 2021 18:34
proxy browser-sync server with express and secure everything with basic auth
// just add pass server as your task function
// Start a server with LiveReload to preview the site in
const OUTPUT_PARENT = 'dist'
const OUTPUT_DIRECTORY = OUTPUT_PARENT + '/browser-sync'
function server(done) {
browser.init({
server: {
directory: true,