Skip to content

Instantly share code, notes, and snippets.

View mrowa44's full-sized avatar

Justyna Rachowicz mrowa44

  • Kraków, Poland
View GitHub Profile
ghGetOrganizationMembers(orgName) {
let page = 1;
const members = [];
return new Promise((resolve, reject) => {
const getNextPage = () => {
githubGet(`orgs/${orgName}/members`, { page })
.then(({ data }) => {
if (data.length > 0) {
page++;
@mrowa44
mrowa44 / console.js
Last active March 30, 2017 05:28
run with `node --inspect console.js`
'use strict';
const repl = require('repl');
// const request = require('supertest');
// const app = require('./app');
const models = require('./models');
const context = repl.start('node> ').context;
context.models = models;
@mrowa44
mrowa44 / plugins.md
Last active January 17, 2017 16:41
Porting Chrome plugins to Firefox

Plugins are really just a tiny web apps that run in a popup.

To load your local extension in Chrome:

  • open up extensions page by putting chrome://extensions/ in the address bar
  • check developer mode at the top
  • click load unpacked extension and select the folder your extension is in

To load your local extension in Firefox:

  • download and install a Nightly build of Firefox
  • create a new profile for testing and development
#!/bin/bash
protected_branch='develop'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push develop, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
html {
font-size: 62.5%;
font-family: 'San Francisco', 'SNFS Display', BlinkMacSystemFont, "Segoe UI", Roboto,
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
/* font-family: -apple-system, BlinkMacSystemFont, Segoe UI,Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif; */
-webkit-font-smoothing: antialiased;
}
function shouldLoadMore(component, node, offset) {
if (typeof component.needsMoreItems === 'function' && component.needsMoreItems()) {
return true;
} else if (node) {
const rect = node.getBoundingClientRect();
const innerHeight = window.innerHeight;
return rect.top + rect.height > innerHeight && innerHeight > rect.bottom - offset;
}
return false;
}
function WindowListener(windowEvents, windowHandler, capture = false) {
const events = (typeof windowEvents === 'string') ? [windowEvents] : windowEvents;
const handler = windowHandler || 'forceUpdate';
return {
componentDidMount() {
for (let i = 0; i < events.length; i++) {
window.addEventListener(events[i], this[handler], capture);
}
},
@mixin theme($prop, $darkcolor, $lightcolor) {
.Dark & {
#{$prop}: #{$darkcolor};
}
.Light & {
#{$prop}: #{$lightcolor};
}
}
@mrowa44
mrowa44 / refresh.rb
Last active March 16, 2016 11:15
Refresh Chrome on file save
#!/usr/bin/env ruby
trap('SIGINT') { exit }
if ARGV.length < 2
puts "Usage: #{$0} directory keyword_from_url"
puts "Example: #{$0} ~/Projects/whatever localhost"
exit
end
getHTML() {
let selector = this.props.selector;
let xhr = new XMLHttpRequest();
xhr.open('GET', this.props.from, true);
xhr.onreadystatechange = function() {
if (this.readyState === 4) {
let parser = new DOMParser();
let document = parser.parseFromString(xhr.responseText, 'text/html');
return document.querySelector(selector);
}