Skip to content

Instantly share code, notes, and snippets.

View nuc's full-sized avatar
🍱
Always Hungry

Georgios Giannoutsos Barkas nuc

🍱
Always Hungry
View GitHub Profile
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@nuc
nuc / gist:fc28090296e0d95108ab19b46f870935
Created October 19, 2016 11:02 — forked from afeld/gist:1254889
YouTube video ID regex
# Parses YouTube URLs directly or from iframe code. Handles:
# * Address bar on YouTube url (ex: http://www.youtube.com/watch?v=ZFqlHhCNBOI)
# * Direct http://youtu.be/ url (ex: http://youtu.be/ZFqlHhCNBOI)
# * Full iframe embed code (ex: <iframe src="http://www.youtube.com/embed/ZFqlHhCNBOI">)
# * Old <object> tag embed code (ex: <object><param name="movie" value="http://www.youtube.com/v/ZFqlHhCNBOI">...)
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
$5 #=> the video ID
# test it on Rubular: http://rubular.com/r/eaJeSMkJvo
@nuc
nuc / tabindexDebug.js
Created September 8, 2016 11:14
Debug tabindex with javascript by listening "tab" key event and show in console the active element. Tested in Chrome 25 and Firefox 19
(function(){
"use strict";
document.addEventListener('keydown', function (event) {
setTimeout(function () {
var key, win, frameEl, activeEl, uri, msg;
msg = "";
key = window.event ? event.keyCode : event.which;
//Tab
if (key === 9) {
@nuc
nuc / plaintext-contenteditable.css
Last active April 18, 2019 01:24 — forked from Schniz/plaintext-contenteditable.css
Plain-Text ContentEditable div for React.js
.comPlainTextContentEditable {
-webkit-user-modify: read-write-plaintext-only;
}
.comPlainTextContentEditable--has-placeholder::before {
content: attr(placeholder);
opacity: 0.5;
color: inherit;
cursor: text;
}
@nuc
nuc / WhyDidYouUpdate.js
Last active December 3, 2017 19:05 — forked from joshma/WhyDidYouUpdateMixin.js
WhyDidYouUpdate Higher Order Component
/* eslint-disable no-console */
import React, { Component } from 'React'
import _ from 'lodash'
/*
* Drop this mixin into a component that wastes
* time according to Perf.getWastedTime() to find
* out what state/props should be preserved. Once it
* says "Update avoidable!" for {state, props},
* you should be able to use shouldComponentUpdate.
@nuc
nuc / README.md
Created August 9, 2012 08:20 — forked from bloudermilk/README.md
Facebook Page Categories

All of the categories!

A really simple JavaScript script that uses jQuery to extract all the categories from Facebook's "Create a page" page.

Works only on chrome, copies all categories into the clipboard!

Instructions

  1. Navigate to the Create a page page.
  2. jquery-inject the page (only for Chrome).
@nuc
nuc / rMBP-install.md
Created August 2, 2012 09:46
Retina MacBook Pro Installation Guide

These are some notes I put together prior to and during setting up my new Retina MacBook Pro. If anyone else is setting up a new machine, it may help you with the process.

Prepare Old Machine

  • Verify Disk with Disk Utility—see here
  • Generate a final TimeMachine backup
  • Verify Crashplan backup is complete
  • Create a final SuperDuper! bootable backup
  • Push changes to remote git repos
@nuc
nuc / .ackrc
Last active October 6, 2015 03:38
Ack config
# Add filters for file types
# Javascript
--type-set
js=.js
# CoffeeScript
--type-set
coffee=.coffee
# Both Javascript and CoffeeScript
@nuc
nuc / randomthumbs.rb
Created April 22, 2012 08:34 — forked from psobot/randomthumbs.rb
Random Image Thumbnailer
# Hacky random image thumbnailer.
# by Peter Sobot, April 21, 2012
# Based heavily on code by Michael Macias
# (https://gist.github.com/a54cd41137b678935c91)
require 'rmagick'
images = Dir.glob(ARGV[0] ? ARGV[0]
: '-default-input-paths-')
output_dir = (ARGV[1] ? ARGV[1]
@nuc
nuc / hack.sh
Created March 31, 2012 14:36 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#