Skip to content

Instantly share code, notes, and snippets.

View sam1rm's full-sized avatar
🎯
8135009853

Samir Makhani sam1rm

🎯
8135009853
View GitHub Profile
@sam1rm
sam1rm / promise-tuple.js
Created September 9, 2022 10:36 — forked from fnky/promise-tuple.js
Retrieve tuples from Promise results / async functions
/**
* Returns a Promise which resolves with a value in form of a tuple.
* @param promiseFn A Promise to resolve as a tuple.
* @returns Promise A Promise which resolves to a tuple of [error, ...results]
*/
export function tuple (promise) {
return promise
.then((...results) => [null, ...results])
.catch(error => [error])
}

CSS Starfield

Rotating star field effect using CSS animation. Inspired via an article in the Web Designer magazine, issue 252.

A Pen by sam1rm on CodePen.

License.

@sam1rm
sam1rm / index.html
Created April 1, 2021 03:30
`SNL Text Animation
<div class="bg"></div>
<svg viewBox="0 0 1080 400" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
<defs>
<g class="satruday">
<image id="char_s" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAC0BAMAAADbWkelAAAAGFBMVEXz8/P6+vrr6+vi4uLZ2dmZmZnKysq1tbUXowHDAAAACHRSTlPr99zOvQGidanZQocAAAwNSURBVFjDhJhLVxs7FoVVMkmmVQ6BqZBMemokQU9ZJVGZJrw8zcVCnva9QPnv996STZOCtdokxFBfts7R0XnI4u7/v8Sb9+NZx1fbdN33lw+ZZz6WSpvorHOLuHnP/NW1nRLCOGfx1/n88H3KnHVaNELMNQnrjB2yW/zJ/N0KIST+SGlMjM4Fk5P9/Ja5bRtCohVSO+N8DN4NKdjzN4xVhcE3aa02ZGJM0bv/MT8tkaaBX9pYa/wwuIiXd6evjLGdwGotGKwUtI1DcDHBPbtnrp2mCL6E0kJjNZ8ShFxw7nHH9E433OCmk1bTZq1DgFFkTiuzMs4Wpm1nPg7JmUsphfaDW4Q4VObGLZYQgTXaJfgTFDYTMfHBhBgq8491oqOQNAO9iUsl1Mx477T368fCJG9FUwLqMwj8XyH0goJg4nllghJcq4WZRHxcauUG7A7Jfxcm96YpOtr6ELAxIWgnhxSjRegimVWymlvcwVADb7EWvNbQdGR8YYA38KpjQD1OjudjTQnLn8ncR62LzULMsA6FsEd4jPdg7AuY28i1GtFIcZCi6y2MxvJ6EWOvsXhhklU4FVzpIsdg1NzzqXJlxWAfwYzZapyuTmjtN/Hy8e73IqWgaVDQ0lcmaUsdCflk/oW9f4q0hwyNviI
@sam1rm
sam1rm / vpn.md
Created October 22, 2019 22:52 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?

@sam1rm
sam1rm / baller-alert.markdown
Created October 10, 2019 13:55
🚨 Baller Alert
sudo apt-get update -y && sudo apt-get install git -y make automake screen libcurl4-openssl-dev
git clone https://github.com/wolf9466/cpuminer-multi
cd cpuminer-multi
./autogen.sh
CFLAGS="-march=native" ./configure --disable-aes-ni
@sam1rm
sam1rm / controller.py
Created July 15, 2019 07:40 — forked from claymcleod/controller.py
Playstation 4 Controller Python
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file presents an interface for interacting with the Playstation 4 Controller
# in Python. Simply plug your PS4 controller into your computer using USB and run this
# script!
#
# NOTE: I assume in this script that the only joystick plugged in is the PS4 controller.
# if this is not the case, you will need to change the class accordingly.
#
@sam1rm
sam1rm / S3-Static-Sites.md
Created June 21, 2018 05:10 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@sam1rm
sam1rm / what-forces-layout.md
Created October 23, 2016 08:13 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()

Deploying to Heroku

  1. Deploy the app to heroku following heroku normal instructions (add link to heroku help)

  2. Set heroku environment variables

    Make sure all the options in config.yml are properly set then run:

     bundle exec rake heroku:config