Skip to content

Instantly share code, notes, and snippets.

@mandiwise
mandiwise / Update remote repo
Last active April 17, 2024 07:41
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@pksunkara
pksunkara / config
Last active April 17, 2024 05:47
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@jimmywarting
jimmywarting / readme.md
Last active April 10, 2024 19:21
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@lynt-smitka
lynt-smitka / fbclid-nginx.conf
Last active March 13, 2024 18:56
Remove fbclid argument from the URL in Nginx
http {
...
# redirect map in http block - remove fbclid argument from the end
map $request_uri $redirect_fbclid {
"~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$" $1;
}
...
@tristanlins
tristanlins / Date.toW3CString.js
Last active February 29, 2024 19:44
Date.toW3CString() method to convert date objects into W3C date time format: yyyy-mm-ddThh:ii:ss+zz:zz
/**
* Convert a Date object to a string, according to W3C date time format: yyyy-mm-ddThh:ii:ss+zz:zz
*
* @memberOf Date
* @access public
* @license MIT
* @copyright 2013 Tristan Lins
* @author Tristan Lins <tristan.lins@bit3.de>
* @link https://gist.github.com/tristanlins/6585391
*/
@dtipson
dtipson / responsive-request-desktop-site.js
Last active February 17, 2024 20:49
How to make responsive sites better respect the "Request a desktop site" feature on modern mobile browsers.
/*
Enable the "Request Desktop Site" functions on mobile chrome (android and iOS) allow users to see desktop layouts on responsive sites. Note that this is distinct from "opt out of mobile!" buttons built into your site: this is meant to work with the browser's native opt-in/opt-out functionality.
Since these functions work, in part, by simply spoofing the user agent to pretend to be desktop browsers, all we have to do is just remember that the browser once claimed to be android earlier in the same session and then alter the viewport tag in response to its fib.
Here's an example viewport tag <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> that we'd be setting to scaleable-yes,max scale=2. That's just an example of something that works on the site I was building: you should customize the "desktop" viewport content setting to whatever works for your site's needs. If you wanted, you could stick this code in the head just after the primary viewport tag so that the br
@larrybotha
larrybotha / A.markdown
Last active February 7, 2024 15:20
Fix SVGs not scaling in IE9, IE10, and IE11

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.

@kripken
kripken / hello_world.c
Last active January 17, 2024 12:15
Standalone WebAssembly Example
int doubler(int x) {
return 2 * x;
}