Skip to content

Instantly share code, notes, and snippets.

function* numbers() {
let index = 1;
while(true) {
yield index;
index = index + 1;
if (index > 10) {
break;
}
}
}
@GiladShoham
GiladShoham / regex.js
Created March 14, 2018 19:08
stuck regex
const jsdocRegex = /\/\*\*\s*\n([^*]*(\*[^/])?)*\*\//g;
const str4 = '/**\n * Basic accordion component\n * @render react\n * @example\n **/';
str4.match(jsdocRegex);
@GiladShoham
GiladShoham / Authorization.jsx
Created April 3, 2017 09:00
React Authorizaion component
import React, { PropTypes } from 'react';
import apConnect from 'apollo-passportjs-react/lib/connect';
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component'
}
const Authorization = (allowedRoles) =>
(WrappedComponent, options = {}) => {
[
{
"keys": ["alt+m"],
"command": "markdown_preview",
"args":
{
"target": "browser",
"parser":"markdown"
}
},
@GiladShoham
GiladShoham / crossrider.sublime-completions
Created January 2, 2014 17:56
sublime text completions for crossrider
{
"completions":
[
{ "trigger": "a", "contents": "<a href=\"$1\">$0</a>" },
{ "trigger": "abbr", "contents": "<abbr>$0</abbr>" },
{ "trigger": "acronym", "contents": "<acronym>$0</acronym>" },
{ "trigger": "cr-closeTab", "contents": "appAPI.tabs.closeTab(tabInfo.tabId);" },
{ "trigger": "cr-createTab", "contents": "appAPI.tabs.create('${1:http://www.example.com}');" },