Skip to content

Instantly share code, notes, and snippets.

@ranyefet
ranyefet / linaria-to-stitches-transformer.js
Last active April 27, 2022 11:53
Linaria CSS to Stitches transformer using JSCodeShift
/**
* Script to help us migrate from linaria to stitches.
* It updates import statements and change `styled` and `css` function calls to use objects
*
* Dry Run:
* `npx jscodeshift -t ./scripts/linaria-to-stitches.js -d -p ./src/components/button.jsx`
*
*/
const ASTTypes = require('ast-types');
const encodeBase64 = (str) => Buffer.from(str).toString('base64');
interface Event {
id: String;
title: String;
type: String;
severity: String;
category: String;
createdAt: Date;
modifiedAt: Date;
@ranyefet
ranyefet / component.js
Created October 16, 2019 07:37
Component Test
import {Component} from "react";
import axios from "axios";
export class Login extends Component {
/**
* Submitting the form
*/
submit() {
// creating a post request to log the user in
async function getManyUsers(ids) {
console.log("getManyUsers", ids);
return ids.map(id => ({ id, name: "name " + id }));
}
function arrayToMap(arr) {
const map = new Map();
arr.forEach(result => {
map.set(result.id, result);
});
@ranyefet
ranyefet / crawler.js
Created August 2, 2018 10:51
A simple web crawler
const got = require("got");
const cheerio = require("cheerio");
const url = require("url");
const URL = url.URL;
const INITIAL_URL = "https://bitcoin.org/";
const MAX_QUEUE_SIZE = 1000;
const MAX_RUNS = 10;
function isRelativePath(url) {

Keybase proof

I hereby claim:

  • I am ranyefet on github.
  • I am ranyefet (https://keybase.io/ranyefet) on keybase.
  • I have a public key ASB40bxNKqYIJ2Oz4r4JFImzOh75kDbEibEs_Q1qZXXflwo

To claim this, I am signing this object:

Installing Copay Wallet

Required software

You need to have a code editor, node.js and git installed on your system. If you already have these installed you can skip this step.

function buildStreamUrl(assetIds = [], format = 'applehttp') {
const baseUrl = `${cdn}/p/${partner}/sp/${partner}00/playManifest/entryId/{entryId}`;
if (format === 'applehttp') {
if (assetsIds.length === 0) {
return baseUrl + `/format/applehttp/protocol/https/a.m3u8`;
} else {
return baseUrl + `/flavorIds/{assetIds.join(',')}format/applehttp/protocol/https/a.m3u8`;
}
}
var posts = response.posts.map(post => {
var reason = post.reason_title ? {
type: post.reason_title.reason_enum,
user: {
id: post.reason_title.user.user_id,
name: post.reason_title.user.name,
}
} : null;
@ranyefet
ranyefet / myPlugin.html
Created May 4, 2015 10:46
myPlugin example test page
<!doctype>
<html>
<head>
<title>My Plugin Test page</title>
<script type="text/javascript" src="../../mwEmbedPath.php/mwEmbedLoader.php"></script>
</head>
<body>
<h2>My Plugin example</h2>
<div class="container">
<div id="kPlayer" style="width: 400px; height: 330px;"></div>