Skip to content

Instantly share code, notes, and snippets.

@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 23, 2024 15:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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:
@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 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@jansanchez
jansanchez / gist:ce5b0ca1c5e538f4b266
Last active February 28, 2024 00:27
How to install NVIDIA video drivers in Elementary OS
@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')
@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(
@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