Skip to content

Instantly share code, notes, and snippets.

View jimthedev's full-sized avatar

Jim Cummins jimthedev

View GitHub Profile
@jayphelps
jayphelps / index.js
Created May 24, 2016 23:47
async window.open()
window.onclick = () => {
// You MUST create the window on the same event
// tick/stack as the user-initiated event (e.g. click callback)
const googleWindow = window.open();
// Do your async work
fakeAjax(response => {
// Change the URL of the window you created once you
// know what the full URL is!
googleWindow.location.replace(`https://google.com?q=${response}`);
@nmn
nmn / VerExBabelPlugin.js
Last active January 21, 2016 03:40
A work in progress to make a Babel plugin that compiles VerbalExpression (nice library to create RegEx) into proper RegEx's at compile time
import VerEx from 'verbal-expressions';
const eventualCallIs = name => {
// FOR PERF
const boundCheck = node =>
node.type === 'Identifier' && node.name === name ||
node.type === 'MemberExpression' && boundCheck(node.object) ||
node.type === 'CallExpression' && boundCheck(node.callee)
return boundCheck;
@nolanlawson
nolanlawson / local-npm.md
Last active September 20, 2016 05:01
Setting up local-npm as a launch daemon on OS X

Setting up local-npm as a launch daemon on OS X

Update! There is now a script to do these steps for you.

These instructions will set up local-npm so that it runs as a launch daemon, meaning that it will start up whenever you log in.

First, install local-npm and pm2:

/**
* RWHttp
*
* Base Class Used for making XHR/AJAX requests, uses the ES6 window.fetch API where available, or Github's polyfill.
*/
import {fetch} from './network/RWFetch';
import {RWHttpRequest} from './network/RWHttpRequest';
import {RWHttpResponse} from './network/RWHttpResponse';
import {RWHttpConfig} from './network/RWHttpConfig';
@terranware
terranware / snsToSlack.js
Last active March 7, 2024 14:47
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws-sns",
"username": "AWS SNS via Lamda :: DevQa Cloud",
#! /bin/sh
# DESCRIPTION Setup wildcard domains using dnsmasq so *.doc is automatically sent to a running boot2docker vm
# MAINTAINER sxalexander@gmail.com
# See:
# https://echo.co/blog/never-touch-your-local-etchosts-file-os-x-again
# https://gist.github.com/r10r/5108046
# http://passingcuriosity.com/2013/dnsmasq-dev-osx/
# check for homebrew
if ! command -v brew >/dev/null; then
@robwormald
robwormald / angular2builds.md
Last active August 29, 2015 14:17
Angular2 2.0.0-alpha.18
  <script src="//jspm.io/system.js" type="text/javascript"></script>
  <script src="//code.innit.io/system.config.js" type="text/javascript"></script>
  <script src="//code.innit.io/zone.js" type="text/javascript"></script>
  <script src="//code.innit.io/angular2/angular2.js" type="text/javascript"></script>
@shuhei
shuhei / 1_before.js
Last active August 29, 2015 14:17
Angular 2 annotation with babel (babel --experimental with experimental branch)
import {Component as _Component, Template as _Template} from 'angular2/src/core/annotations/annotations';
function makeDecorator(annotationClass) {
return (options) => {
return (klass) => {
klass.annotations = klass.annotations || [];
klass.annotations.push(new annotationClass(options));
return klass;
};
};
@DavidFrahm
DavidFrahm / 020_build_version.js
Last active December 28, 2020 00:05
Cordova build hook, to use build version from config.xml in your hybrid app
#!/usr/bin/env node
// This plugin replaces text in a file with the app version from config.xml.
var wwwFileToReplace = "js/build.js";
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
@xavhan
xavhan / Shazam to youtube and spotify.js
Last active January 9, 2018 08:58
Shazam Crawler and Youtube Searcher in the console
var data = [];
$(".ti__details").each(function(i){
var artist = $(this).find(".ti__artist meta").attr("content");
var title = $(this).find(".ti__title").attr("content");
var format = artist + " - " + title;
var yt = 'http://www.youtube.com/results?search_type=&search_query=' + encodeURI(artist + " " + title) + '&aq=f&oq=';
var spoti = 'https://play.spotify.com/search/'+ encodeURI(artist + " " + title);
var item = new Object;
console.groupCollapsed(format);
console.log(yt);