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
@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 / 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 / upload-sourcemap.js
Last active March 27, 2019 06:12
Upload sourcemaps to Sentry
/* eslint-disable no-sync */
const request = require('superagent')
const path = require('path')
const fs = require('fs')
const ACCOUNT = 'account'
const PROJECT = 'project-name'
const TOKEN = 'your-token'
const ASSET_URL = 'https://example.com/assets'
const SOURCEMAPS_PATH = './temp'
@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 / 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
class DeepStruct < OpenStruct
def initialize(hash=nil)
@table = {}
@hash_table = {}
if hash
hash.each do |k,v|
@table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v)
@hash_table[k.to_sym] = v
@nuc
nuc / non-expiring-fb-page-tokens.md
Last active June 14, 2025 23:23
How to generate Non-Expiring Facebook Page tokens

Non-Expiring Facebook Page tokens

/*
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
<!--
Browser support: partial
Success rate: 30%-90% depending on browser
Can prefetch HTML: yes
-->
<link rel="prefetch" href="index.html" />
@nuc
nuc / .gvimrc
Last active May 14, 2019 09:44
vimrc
set macmeta
" MacVim GUI mode
if has("gui_macvim")
" Dark
set guifont=Operator\ Mono\ Light:h14
" set guifont=Droid\ Sans\ Mono:h12
" Light
" set guifont=Source\ Code\ Pro:h12