Skip to content

Instantly share code, notes, and snippets.

View riteshhota2008's full-sized avatar

Ritesh Hota riteshhota2008

View GitHub Profile
@riteshhota2008
riteshhota2008 / goodread_isbn.js
Created September 9, 2018 19:11 — forked from hitswa/goodread_isbn.js
fetching Goodread book data from API using ISBN with cross domain Access-Control-Allow-Origin CORP solution
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
goodRead('9382749004'); // not found
goodRead('0441172717'); // single author
goodRead('0552137030'); // multiple author
function goodRead(isbn) {
var key = "<your key>"; // replace with your key
@riteshhota2008
riteshhota2008 / demo.php
Created July 22, 2018 21:23 — forked from freekrai/demo.php
PHP session-based rate limiter for APIs
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
@riteshhota2008
riteshhota2008 / mysql_pdo_connect.php
Created June 30, 2018 07:00 — forked from nasirkhan/mysql_pdo_connect.php
MySQL PDO Unicode Issue fix
<?php
/*
* The following function will create a PDO connection form PHP.
* It sovles the issue of inserting the Unicode Characters.
*/
function connect_db() {
$servername = "localhost";
$db_username = "root";
$db_password = "root";
@riteshhota2008
riteshhota2008 / strong-passwords.php
Created April 14, 2018 06:51 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@riteshhota2008
riteshhota2008 / media-query.css
Created April 5, 2018 13:25 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS

MAMP PRO 4 Trial Reset

A simple script that resets latest MAMP PRO 4 trial validity, and keeps your data safe.

How to use

  • Copy the code into a file OR download the script and save it as reset_mamp4.sh
  • Open the Terminal app and write chmod +x then drag and drop the file on the Terminal. You should have something like chmod +x reset_mamp4.sh. Press Enter to run it.
  • Now, run the file itself by dragging and dropping it on the Terminal (something like reset_mamp4.sh) then pressing Enter.
  • Open MAMP PRO and check if you have 14 days left now.

Didn't work?

@riteshhota2008
riteshhota2008 / LICENCE SUBLIME TEXT
Created January 24, 2018 08:08
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@riteshhota2008
riteshhota2008 / hangman_1.py
Created March 12, 2016 11:05 — forked from DevDarren/hangman_1.py
A simple hangman game made with Python 2.7.3
class Hangman():
def __init__(self):
print "Welcome to 'Hangman', are you ready to die?"
print "(1)Yes, for I am already dead.\n(2)No, get me outta here!"
user_choice_1 = raw_input("->")
if user_choice_1 == '1':
print "Loading nooses, murderers, rapists, thiefs, lunatics..."
self.start_game()
elif user_choice_1 == '2':
@riteshhota2008
riteshhota2008 / hangman.py
Created February 8, 2016 16:12 — forked from danverbraganza/hangman.py
Hangman implemented in 3 lines of Python
license, chosen_word, guesses, scaffold, man, guesses_left = 'https://opensource.org/licenses/MIT', ''.join(filter(str.isalpha, __import__('random').choice(open('/usr/share/dict/words').readlines()).upper())), set(), '|======\n| |\n| {3} {0} {5}\n| {2}{1}{4}\n| {6} {7}\n| {8} {9}\n|', list('OT-\\-//\\||'), 10
while not all(letter in guesses for letter in chosen_word) and guesses_left: _, guesses_left = map(guesses.add, filter(str.isalpha, raw_input('%s(%s guesses left)\n%s\n%s:' % (','.join(sorted(guesses)), guesses_left, scaffold.format(*(man[:10-guesses_left] + [' '] * guesses_left)), ' '.join(letter if letter in guesses else '_' for letter in chosen_word))).upper())), max((10 - len(guesses - set(chosen_word))), 0)
print 'You', ['lose!\n' + scaffold.format(*man), 'win!'][bool(guesses_left)], '\nWord was', chosen_word