Skip to content

Instantly share code, notes, and snippets.

@vmysla
vmysla / frameless-querySelectorAll.js
Last active August 29, 2015 14:27
Frameless document.querySelectorAll shim
/// @usage document.querySelectorAll('body');
/// @returns array of matched elements from document and his IFRAMEs (CORS)
document.querySelectorAll = function(){
var result = [].slice.call( HTMLDocument.prototype.querySelectorAll.apply(document, arguments ) );
for(var i=0; i< frames.length; i++){
try {
var doc = frames[i].document;
result = result.concat( [].slice.call( doc.querySelectorAll.apply(doc, arguments) ) );
} catch(e){}
}
@vmysla
vmysla / iframer-v2.js
Last active September 3, 2015 11:08
iframer-v2.js
/*
// ------------ Usage: -------------
// =================================
var container = document.querySelector('body');
var html = "<h1>Timestamp <script>document.write( Date.now() );</script></h1>";
function logFrameEvent(frame, eventName){
console.log(
@HenrikJoreteg
HenrikJoreteg / README.md
Last active September 20, 2021 01:36
Minimalist routing in Redux

Why would you want to do this? Because you often don't need more. It's nice to not have to think about your "router" as this big special thing.

Instead, with this approch, your app's current pathname is just another piece of state, just like anything else.

This also means that when doing server-side rendering of a redux app, you can just do:

var app = require('your/redux/app')
var React = require('react')
@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:
@danielbayley
danielbayley / pnpm.command
Last active August 4, 2023 18:19
A shim to seamlessly alias @npm to @pnpm.
#! /bin/zsh --no-rcs --err-exit
export PATH=node_modules/.bin:$PATH
alias -g i=install
if (($+commands[pnpm])) then
local p=p
alias pnpm=npm npx=pnpx
# FIXME https://github.com/pnpm/pnpm/issues/1360
npm config get -g global-dir | read
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@jansanchez
jansanchez / gist:ce5b0ca1c5e538f4b266
Last active February 28, 2024 00:27
How to install NVIDIA video drivers in Elementary OS
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active April 2, 2024 00:08
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing