Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
mojavelinux / nodegit-private-clone-test.js
Created May 21, 2018 08:45
Clone a private repository using nodegit
const git = require('nodegit')
const fs = require('fs-extra')
const { URL } = require('url')
const REPO_URL = '[email protected]:org/path.git'
const CLONE_DIR = '/tmp/private-repo-clone-test'
;(async () => {
await fs.emptyDir(CLONE_DIR)
let authAttempted = false
await git.Clone.clone(REPO_URL, CLONE_DIR, {
@vital101
vital101 / nodegit.js
Created September 26, 2016 10:36
NodeGit Clone Private with Token
const repo = 'vital101/kernl-example-plugin-gitub';
const token = 'my-token-from-oauth';
const cloneURL = `https://${token}:[email protected]/${repository}`;
const cloneOptions = {
fetchOpts: {
callbacks: {
certificateCheck: () => { return 1; },
credentials: () => {
return NodeGit.Cred.userpassPlaintextNew(token, 'x-oauth-basic');
}
@dmvaldman
dmvaldman / promisesEM.md
Last active June 1, 2024 00:20
Promises as EventEmitters

Promises as EventEmitters

I was trying to understand JavaScript Promises by using various libraries (bluebird, when, Q) and other async approaches.

I read the spec, some blog posts, and looked through some code. I learned how to

@bjork24
bjork24 / gist:fd53130815c5e01ba91a
Created February 16, 2015 20:07
Easy selectors
var $ = document.querySelectorAll.bind(document);
var $_ = document.querySelector.bind(document);
@pburtchaell
pburtchaell / styles.css
Last active February 12, 2025 08:45
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@weotch
weotch / header.html
Created June 18, 2014 19:24
Custom modernizr tests
<script src="/js/libs/modernizr.js"></script>
<script type="text/javascript">
var ua = navigator.userAgent;
Modernizr.addTest('retina', window.devicePixelRatio > 1);
Modernizr.addTest('webkit', navigator.userAgent.match(/AppleWebKit/i));
Modernizr.addTest('ipad', navigator.userAgent.match(/iPad/i));
Modernizr.addTest('iphone', navigator.userAgent.match(/iPhone/i));
Modernizr.addTest('ipod', navigator.userAgent.match(/iPod/i));
Modernizr.addTest('ios', Modernizr.ipad || Modernizr.ipod || Modernizr.iphone);
Modernizr.addTest('android', navigator.userAgent.match(/Android/i));
@benplum
benplum / matchMedia - IE9
Last active April 16, 2020 15:57
matchMedia Polyfill w/ Listeners - IE9
// Modernizr style test
if (!(window.webkitMatchMedia || window.mozMatchMedia || window.oMatchMedia || window.msMatchMedia || window.matchMedia)) {
var root = document.getElementsByTagName( 'html' )[0];
root.className += ' no-matchmedia';
}
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
window.matchMedia || (window.matchMedia = function() {
"use strict";
@snipe
snipe / googleform2email
Last active November 16, 2017 21:37
Script to get the contents of a Google form submission emailed to you.
function sendFormByEmail(e)
{
// Remember to replace this email address with your own email address
var email = "[email protected]";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
var subject = "New Hire: ";
@ksafranski
ksafranski / SimpleStore.js
Last active July 2, 2022 15:25
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve:
@leostratus
leostratus / webkit-pseudo-elements.md
Created September 21, 2012 01:44
Webkit Pseudo-Element Selectors (Shadow DOM Elements)

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;