Skip to content

Instantly share code, notes, and snippets.

View northamerican's full-sized avatar
🚲

Chris Bitsakis northamerican

🚲
View GitHub Profile
@mattattui
mattattui / index.html
Last active October 24, 2020 11:28
Vue + Paper
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Shape selection</title>
<!-- Vue for doing stuff-->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- Paper for handling graphics -->
<script src="https://unpkg.com/paper@0.11.3/dist/paper-full.min.js"></script>
<!-- Axios for making API calls -->
@richy486
richy486 / youtube_m3u8.txt
Created January 6, 2017 21:16
get youtube streaming url
from: http://stackoverflow.com/a/35631022/667834
$ brew install youtube-dl
$ youtube-dl --list-formats https://www.youtube.com/watch\?v\=[YouTube video id]
shows something like:
....
91 mp4 144p HLS , h264, aac @ 48k
@mjackson
mjackson / fetchJSON.js
Created February 23, 2016 22:23
fetch JSON with a callback
function fetchJSON(url, options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
options = options || {}
const headers = (options.headers || (options.headers = {}))
headers.Accept = 'application/json'
@ebidel
ebidel / dom-property-watcher.js
Created September 12, 2015 17:01
DOM property watcher using ES6 proxies.
// Watch accesses/sets on a DOM element property.
function watchPropsOn(el) {
return new Proxy(el, {
get(target, propKey, receiver) {
//return Reflect.get(target, propKey, receiver);
console.log('get', propKey);
return el[propKey];
},
set(target, propKey, value, receiver) {
console.log('set', propKey, value);
@jonnymaceachern
jonnymaceachern / mobile-resize-check.js
Created September 4, 2015 14:29
A resize event is triggered when a mobile browsers address bar drops down (when changing directions in a scroll). This will let you check for only width resizes. From http://stackoverflow.com/questions/10750603/jquery-detect-a-window-width-change-but-not-a-height-change
var width = $(window).width();
$(window).resize(function(){
if($(this).width() != width){
width = $(this).width();
console.log(width);
// your code
}
});
@nizaroni
nizaroni / github-credit.sh
Created February 20, 2015 15:14
How to clone someone else's repository and still get GitHub credit for your changes.
# Clone the other person's repo.
# MAKES A NEW FOLDER! CAUTION!
$ git clone https://github.com/khalifenizar/bbq
# Rename that person's remote GitHub repo.
$ git remote rename origin khalifenizar
# Add your remote GitHub repo
$ git remote add origin https://github.com/yourusername/bbq
@addyosmani
addyosmani / package.json
Last active May 29, 2024 15:54
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@rjacoby
rjacoby / gist:46f7ceb900f97b0cc8f4
Created July 31, 2014 17:43
Facebook STOP! console code
__d("Chromedome", ["fbt"], function(a, b, c, d, e, f, g) {
f.start = function(h) {
if (h.off || top !== window ||!/(^|\.)facebook\.com$/.test(document.domain))
return;
var i = h.stop || "Stop!", j = h.text || "This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.", k = h.more || g._("For more information, see {url}.", [g.param("url", 'https://www.facebook.com/selfxss')]);
if ((window.chrome || window.safari)&&!h.textonly) {
var l = 'font-family:helvetica; font-size:20px; ';
[[i, h.c1 || l + 'font-size:50px; font-weight:bold; ' + 'color:red; -webkit-text-stroke:1px black;'], [j, h.c2 || l], [k, h.c3 || l], ['', '']].map(function(r) {
setTimeout(console.log.bind(console, '\n%c' + r[0], r[1]));
});
@joshuabaker
joshuabaker / getTweetHTML.js
Last active December 23, 2015 09:09
Switches tweet entities, from a Twitter API response, into anchor links, returning HTML ready for display. Built for use with https://github.com/joshuabaker/twitter-proxy
var getTweetHTML = function(tweet)
{
var i, item, entities = {}, html = tweet.text, target;
for (i in tweet.entities.hashtags)
{
item = tweet.entities.hashtags[i];
entities[item.indices[0]] = [item.indices[1], '<a href="https://twitter.com/search?q=%23' + item.text + '" target="_blank">#' + item.text + '</a>'];
}