Skip to content

Instantly share code, notes, and snippets.

View shospodarets's full-sized avatar

Serg Hospodarets shospodarets

View GitHub Profile
@shospodarets
shospodarets / remove-merged-branches-to-the-current.sh
Last active May 2, 2017 11:15
Remove Git branches, which are merged to the current one (+ ability to exclude some of them)
#!/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
@shospodarets
shospodarets / delete-local-branches-except-the-current.sh
Last active May 2, 2017 11:16
Delete all the local Git branches except the current one
#!/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 May 6, 2024 10:24
Top-level `await` is a footgun

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 September 2, 2018 16:53
Apache GZIP compression and Expires headers
# 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 March 19, 2024 23:31
Local SSL websites on macOS Sierra

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"
@shospodarets
shospodarets / Native JavaScript promises API
Last active September 26, 2016 12:47
Description of the native JavaScript promises API with examples
// 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 February 12, 2024 03:22
Genymotion with Google Play Services for ARM
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 June 27, 2013 00:41
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@willurd
willurd / web-servers.md
Last active May 19, 2024 20:19
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000