Skip to content

Instantly share code, notes, and snippets.

View suvozy's full-sized avatar
🙇‍♂️
··· 🤖

Shubhajit Saha suvozy

🙇‍♂️
··· 🤖
View GitHub Profile
@suvozy
suvozy / Setup.md
Last active December 28, 2022 07:43
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@suvozy
suvozy / Readme.md
Last active August 29, 2015 13:56
Git Deploy
sudo -i

#Build webapp key

sudo -Hu webapp ssh-keygen -t rsa # choose "no passphrase"

or

@suvozy
suvozy / Bash Commands.md
Last active February 27, 2016 22:50
Mac

Remove __MACOSX file from .zip

zip -d /Users/suvozit/Desktop/php-sample/Archive.zip "__MACOSX*"

Show / Hide hidden files on Mac OS X

To show hidden files on your mac launch Terminal and enter these commands:

defaults write com.apple.Finder AppleShowAllFiles TRUE
<?php
/*
* Because we are removing the ending `=` padding we will have a string length of
* md5 <= 24
* sha1 <= 28
*
* Probably should just remove the code that trims the equal sign since it's kind of pointless....
*/

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@suvozy
suvozy / ratio.css
Last active August 29, 2015 14:17 — forked from agriboz/ratio.css
img{
min-width: 100%;
height: auto;
}
.content{
position: absolute;
top: 0;
left: 0;
bottom: 0;
@suvozy
suvozy / 1. Enable.md
Last active July 5, 2023 12:29
PHP Dev on Mac OS X 10.10 (PHP, MySQL, Apache, Composer)

Apache

to start it

sudo apachectl start

to stop it

sudo apachectl stop

to restart it

@suvozy
suvozy / map_view.php
Created August 28, 2015 16:19
Bing maps: create url and determining best map view for an array of locations
<?php
// https://rbrundritt.wordpress.com/2009/07/21/determining-best-map-view-for-an-array-of-locations/
// Calculates the best map view for a list of locations for a map
//
// locations = List of location objects
// map_width = Map width in pixels
// map_height = Map height in pixels
// buffer = Width in pixels to use to create a buffer around the map. This is to keep pushpins from being cut off on the edge
//
// Returns a MapViewSpecification with the best map center point and zoom level for the given set of locations
@suvozy
suvozy / Exiftool Cheatsheet.md
Last active November 12, 2023 01:52
Exiftool Cheatsheet

DD-MM-YY_HHMM.JPG

exiftool '-datetimeoriginal<${filename;s/(\d{2})-(\d{2})-(\d{2})_(\d{2})(\d{2})/20$3-$2-$1 $4:$5:00/}' .

Set DateTimeOriginal to Any Arbitrary Timestamp

exiftool '-datetimeoriginal=1000-01-01 00:00:00' .