Skip to content

Instantly share code, notes, and snippets.

Serg Hospodarets malyw

Block or report user

Report or block malyw

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
@malyw
malyw / remove-merged-branches-to-the-current.sh
Last active May 2, 2017
Remove Git branches, which are merged to the current one (+ ability to exclude some of them)
View remove-merged-branches-to-the-current.sh
#!/usr/bin/env bash
# based on https://gist.github.com/schacon/942899
# list
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1
# delete
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1 | awk '{sub(/origin\//,"");print}' | xargs git push origin --delete
@malyw
malyw / delete-local-branches-except-the-current.sh
Last active May 2, 2017
Delete all the local Git branches except the current one
View delete-local-branches-except-the-current.sh
#!/usr/bin/env bash
git branch | grep -v (git rev-parse --abbrev-ref HEAD) | xargs git branch -D
@Rich-Harris
Rich-Harris / footgun.md
Last active Sep 17, 2019
Top-level `await` is a footgun
View footgun.md

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@darcyliu
darcyliu / .htaccess
Last active Sep 2, 2018
Apache GZIP compression and Expires headers
View .htaccess
# BEGIN GZIP
# http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
<IfModule mod_deflate.c>
# Enabling Compression
SetOutputFilter DEFLATE
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
@jonathantneal
jonathantneal / README.md
Last active Sep 17, 2019
Local SSL websites on macOS Sierra
View README.md

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@malyw
malyw / Native JavaScript promises API
Last active Sep 26, 2016
Description of the native JavaScript promises API with examples
View Native JavaScript promises API
// Current browser support for native promises: http://kangax.github.io/compat-table/es6/#Promise
// Article: http://www.html5rocks.com/en/tutorials/es6/promises/
// Polyfills:
// https://github.com/getify/native-promise-only
// https://github.com/jakearchibald/es6-promise
/*------------------------------ GET PROMISE ------------------------------*/
// N.B.: Promises pass only first argument to resolve/reject callbacks, others are ignored
function doSomething(){
return new Promise(function(resolve, reject) {
@wbroek
wbroek / genymotionwithplay.txt
Last active Sep 12, 2019
Genymotion with Google Play Services for ARM
View genymotionwithplay.txt
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@fabiofl
fabiofl / gist:5873100
Created Jun 27, 2013
Clear Mac OS X's icon cache.
View gist:5873100
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active Sep 15, 2019
A badass list of frontend development resources I collected over time.
View frontendDevlopmentBookmarks.md
@getify
getify / gist:2926699
Created Jun 13, 2012
non-rectangular (line and circle) clears in canvas
View gist:2926699
/*
To see a demo of these in use, check out: http://test.getify.com/test-canvas-clear-alt.html
Example uses:
*/
clearCircle(context,/*x=*/120,/*y=*/80,/*radius=*/60);
clearLineSquared(context,/*x1=*/10,/*y1=*/10,/*x2=*/53,/*y2=*/67,/*thickness=*/5);
clearLineRounded(context,/*x1=*/15,/*y1=*/100,/*x2=*/90,/*y2=*/170,/*thickness=*/10);
You can’t perform that action at this time.