Skip to content

Instantly share code, notes, and snippets.

View myTerminal's full-sized avatar
🎯
Filling gaps, one at a time

Mohammed Ismail Ansari myTerminal

🎯
Filling gaps, one at a time
View GitHub Profile
@aarnone
aarnone / pbcopy-and-pbpaste-in-arch-linux.md
Created May 14, 2018 21:06
Get pbcopy and pbpaste in Arch Linux

Get pbcopy and pbpaste in Arch Linux

First you need the 'xsel' package.

$> pacman -S xsel

Then create aliases.

alias pbcopy='xsel --clipboard --input'

alias pbpaste='xsel --clipboard --output'

@jcubic
jcubic / cross-domain.js
Last active December 10, 2018 20:34
Cross domain ajax request without CORS using iframe and postMessage
$.fn.crossDomainRequest = function(url, method, data, fn) {
var self = this;
var receiver = self.attr('src').replace(/\/.*$/, '').replace(/^https?::\/\//, '');
function get(event) {
if (event.origin.match(receiver)) {
// event.data is response from POST
fn(event.data);
}
}
if (window.addEventListener){
@phlik
phlik / urlRewriteReverseProxy.js
Created February 25, 2014 14:37
Simple reverse proxy in node with url rewrite.
var http = require('http');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
http.createServer(function(req, res){
if(/^\/api/.test(req.url)){
req.url = req.url.replace(/^\/api/, "");
proxy.web(req, res, {target:'http://localhost:7889'});
} else {