Skip to content

Instantly share code, notes, and snippets.

View axipo's full-sized avatar
🎯
Focusing

axipo axipo

🎯
Focusing
  • Zhejiang/Hangzhou
View GitHub Profile
@carolineschnapp
carolineschnapp / google_translate.html
Created February 1, 2011 19:27
Google Translate Embed Code
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@maxim75
maxim75 / exif.html
Created May 19, 2011 06:03
Reading EXIF info from image with JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<title>h5</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script src="exif.js"></script>
<style>
#holder { border: 1px dashed #ccc; width: 100px; height: 100px; margin: 20px auto;}
#holder.hover { border: 1px dashed #333; }
#result .property { width: 100px; }
@JohnAllsopp
JohnAllsopp / Private Browsing and localStorage
Created December 13, 2011 06:59
Private Browsing and localStorage - different browsers handle it differently
What happens to localStorage when different browsers are in private browsing mode?
Safari returns null for any item set using localStorage.setItem either before or during the private browsing session. In essence, neither sessionStorage or localStorage are available in private brosing mode
Chrome and Opera return items set previous to private ("incognito") browsing, but once private browsing commences, treats localStorage like sessionStorage (only items set on the localStorage by that session will be returned) but like localStorage for other private windows and tabs
Firefox, like Chrome will not retrieve items set on locaStorage prior to a private session starting, but in private browsing treats localStorage like sessionStoroage for non private windows and tabs, but like localStorage for other private windows and tabs
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@OleMchls
OleMchls / index.html
Created March 4, 2014 02:35
pdf.js text rendering
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://mozilla.github.io/pdf.js/build/pdf.js"></script>
<script src="http://vivin.net/pub/pdfjs/textlayerbuilder.js"></script>
</head>
<body>
<div id="pdfContainer" class = "pdf-content">
</div>
<script>
@Integralist
Integralist / GitHub curl.sh
Last active June 18, 2024 23:31 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@nelsnelson
nelsnelson / lxc-minimal.sh
Created March 17, 2014 15:54
Template for LXC intended to provide a minimal rootfs and ran as a daemon
#!/bin/bash
#
# lxc: linux Container library
# Authors:
# Daniel Lezcano <daniel.lezcano@free.fr>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@danallison
danallison / downloadString.js
Created September 29, 2014 16:44
download string as text file
function downloadString(text, fileType, fileName) {
var blob = new Blob([text], { type: fileType });
var a = document.createElement('a');
a.download = fileName;
a.href = URL.createObjectURL(blob);
a.dataset.downloadurl = [fileType, a.download, a.href].join(':');
a.style.display = "none";
document.body.appendChild(a);
a.click();
@arulrajnet
arulrajnet / ChromeAppDownloader.py
Last active February 15, 2024 01:06
Python Script to download the Chrome Extensions (CRX) file directly from the google chrome web store.
# -*- coding: utf-8 -*-
"""
Python Script to download the Chrome Extensions (CRX) file directly from the google chrome web store.
Referred from http://chrome-extension-downloader.com/how-does-it-work.php
"""
from __future__ import division
import argparse
import requests
@moiseevigor
moiseevigor / xstat
Last active October 12, 2022 06:32
xstat bash function to get file creation time on Linux with EXT4
xstat() {
for target in "${@}"; do
inode=$(ls -di "${target}" | cut -d ' ' -f 1)
fs=$(df "${target}" | tail -1 | awk '{print $1}')
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null |
grep -oP 'crtime.*--\s*\K.*')
printf "%s\t%s\n" "${crtime}" "${target}"
done
}