Skip to content

Instantly share code, notes, and snippets.

Avatar

Nguyen Duc Ban ducban

View GitHub Profile
View Gradient shadow in pure CSS.md

Gradient shadow in pure CSS

alt text

HTML
<button>Let's Go !</button>
@ducban
ducban / ssl-forcing.js
Created Mar 28, 2018
SSL forcing using JS
View ssl-forcing.js
/* Paste this shit after the open head tag <head> */
<script type="text/javascript">
if (window.location.protocol != "https:")
window.location.protocol = "https";
</script>
@ducban
ducban / .zshrc
Created Dec 22, 2017 — forked from SlexAxton/.zshrc
My gif workflow
View .zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@ducban
ducban / Auto-Play.md
Last active Oct 16, 2017
No auto-play on modern browsers
View Auto-Play.md

Tips from Quang Anh Do

  • Chrome Beta: chrome://flags/#autoplay-policy > Document user activation is required
  • Safari: Preferences > Websites > Auto-Play > When visiting other websites: Never Auto-Play
  • Firefox: about:config > media.autoplay.enabled > false
View keybase.md

Keybase proof

I hereby claim:

  • I am ducban on github.
  • I am ducban (https://keybase.io/ducban) on keybase.
  • I have a public key whose fingerprint is 2F70 C3F3 8034 886F D35B AEE3 98BB B015 9DD5 847B

To claim this, I am signing this object:

@ducban
ducban / Redirect to a custom page after registration
Created Oct 17, 2013
Here is a very handy code snippet to redirect the user to a custom page after registration on your WordPress blog or website. Super useful for those using WP as a CMS! Simply drop this snippet in your functions.php or a plugin.
View Redirect to a custom page after registration
function __my_registration_redirect(){
return home_url( '/my-page' );
}
add_filter( 'registration_redirect', '__my_registration_redirect' );
@ducban
ducban / View all WP query variables
Created Aug 10, 2013
Paste the code below on any files, where you'd like to display the WP Query variables.
View View all WP query variables
global $wp_query;
var_dump($wp_query->query_vars);
@ducban
ducban / more.md
Created Apr 21, 2012 — forked from vasilisvg/more.md
This is my backup script which syncs my server to my dropbox every day.
View more.md

The script below is triggered every day from my Mac. I use Hazel to move the tar.gz to an external hard disk once it's finished. This happens every day without me noticing.

You should have a similar script.

View Adding rounded corner to MKMapView
// These options are just collected and didn't test yet.
// Option 01:
#import <QuartzCore/QuartzCore.h>
myMapView.layer.cornerRadius = 10.0;
// Option 02:
float scaleBy = 0.80;
MKMapView *mapView = [[[MKMapView alloc] initWithFrame:CGRectMake(-5, 0, 100/ scaleBy, 50/scaleBy)] autorelease];
mapView.delegate=self;