Skip to content

Instantly share code, notes, and snippets.

Ilya Zub ilyazub

Block or report user

Report or block ilyazub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ibrahima
ibrahima / CodeBlock.jsx
Last active May 25, 2020
Syntax highlighting for react-markdown
View CodeBlock.jsx
import React from 'react';
import PropTypes from 'prop-types';
import SyntaxHighlighter from 'react-syntax-highlighter';
export default class CodeBlock extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
language: PropTypes.string,
}
@Rich-Harris
Rich-Harris / prepack-svelte.md
Last active Nov 11, 2019
Is Prepack like Svelte?
View prepack-svelte.md

Note: I'm not involved in Prepack in any way — please correct me if I say anything incorrect below!

A few people have asked me if Prepack and Svelte are similar projects with similar goals. The answer is 'no, they're not', but let's take a moment to explore why.

What is Prepack?

Prepack describes itself as a 'partial evaluator for JavaScript'. What that means is that it will run your code in a specialised interpreter that, rather than having some effect on the world (like printing a message to the console), will track the effects that would have happened and express them more directly.

So for example if you give it this code...

@mshkrebtan
mshkrebtan / webex-ubuntu.md
Last active May 28, 2020
Run Cisco Webex on 64-bit Ubuntu 16.04
View webex-ubuntu.md

Run Cisco Webex on 64-bit Ubuntu 16.04

With Audio and Screen Sharing Enabled

Enable support for 32-bit executables

Add the i386 architecture to the list of dpkg architectures :

sudo dpkg --add-architecture i386
@dimkir
dimkir / nightmare-on-amazon-linux.MD
Last active Dec 24, 2019
How to run nightmare on Amazon Linux
View nightmare-on-amazon-linux.MD

Running nightmare on Amazon Linux

You may have thought of running nightmare on AWS Lambda. But before we can run it on Lambda, we need first to make it run on Amazon Linux.

Provision instance which replicates Lambda environment

According to AWS Documentation on Lambda Execution Environment and available Libraries we would need this AMI image with this alias amzn-ami-hvm-2016.03.3.x86_64-gp2. Keep in mind that AMI-image-id for this instance would be different in different regions (eg):

  • In eu-west-1 - ami-f9dd458a
  • In us-east-1 - ami-6869aa05
@SahAssar
SahAssar / css-var-polyfill.js
Last active Apr 30, 2018 — forked from stramel/css-var-polyfill.js
CSS Variable Polyfill
View css-var-polyfill.js
/*
TODO:
- Option to wait to apply anything until all <link>s are parsed or inject what we have and update as each <link> returns
*/
var cssVarPoly = {
init: function() {
if (window.CSS && window.CSS.supports && window.CSS.supports('(--foo: red)')) {
return;
}
cssVarPoly.ratifiedVars = {};
@manfe
manfe / helper.rb
Last active Jan 14, 2020
Rails Helper to build Hierachical HTML List
View helper.rb
module TreeListHelper
# the collection need to be the root parents
def tree_list(collection)
content_tag(:ul) do
collection.each do |item|
if item.children.any?
concat(
content_tag(:li, id: item.id) do
concat(item.name)
concat(tree_list(item.children))
@paulirish
paulirish / what-forces-layout.md
Last active May 27, 2020
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@palkan
palkan / gist:d89757a90cfbeb047c63
Last active May 14, 2020
Rails debug cheat sheet
View gist:d89757a90cfbeb047c63

Setup

Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug.

gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]

Using PRY

@abaird
abaird / output.txt
Last active Jan 3, 2020
Run tests with RSpec formatter in Rake task
View output.txt
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--format html', '--out spec/reports/results.html']
t.pattern = 'spec/heartbeat/heartbeat_spec.rb'
end
task :clean do
rm_rf 'spec/reports'
You can’t perform that action at this time.