Skip to content

Instantly share code, notes, and snippets.

View amitavroy's full-sized avatar
🏠
Working from home

Amitav Roy amitavroy

🏠
Working from home
View GitHub Profile
@amitavroy
amitavroy / gist:5748254
Created June 10, 2013 12:03
Get all tweets of a specific hashtag
function getTweets($hash_tag) {
$url = 'http://search.twitter.com/search.atom?q='.urlencode($hash_tag) ;
echo "<p>Connecting to <strong>$url</strong> ...</p>";
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$xml = curl_exec ($ch);
curl_close ($ch);
//If you want to see the response from Twitter, uncomment this next part out:
@amitavroy
amitavroy / gist:5748261
Created June 10, 2013 12:04
Adding odd even class
<div class="example-class<?php echo ($xyz++%2); ?>">
@amitavroy
amitavroy / html_default
Last active December 18, 2015 22:59
This is my default html file as a starting point
<!doctype html>
<html lang="en" ng-app="anim">
<head>
<meta charset="UTF-8">
<title>Test page</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
<script>
var anim = angular.module('anim', []);
anim.controller('MainCtrl', ['$scope', function ($scope) {
@amitavroy
amitavroy / gist:6507518
Created September 10, 2013 10:20
Calculate Page load time
<script>
var t0 = window.performance.now();
</script>
<script>
var t1 = window.performance.now();
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
</script>
@amitavroy
amitavroy / PasswordHash.php
Created August 6, 2018 06:09
Wordpress user password check on other system
<?php
/**
* Portable PHP password hashing framework.
* @package phpass
* @since 2.5.0
* @version 0.3 / WordPress
* @link http://www.openwall.com/phpass/
*/
#
@amitavroy
amitavroy / .gitlab-ci.yml
Last active January 25, 2019 23:47
Continuous Integration with Gitlab
stages:
- test
# Variables: these have to match
# the .env.example credentials in your Laravel app
# use the default homestead/secret combination, since
# that database gets created in the edbizarro/gitlab-ci-pipeline-php:7.1
# docker image.
variables:
MYSQL_ROOT_PASSWORD: root
@amitavroy
amitavroy / composer.json
Created April 20, 2019 05:33
Packages from local folder and private repo
"repositories": [
{
"type": "path",
"url": "./packages/test"
},
{
"type": "vcs",
"url": "https://github.com/amitavroy/package-name"
}
]
@amitavroy
amitavroy / curl.md
Created April 26, 2019 07:11 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@amitavroy
amitavroy / infinitescroll.js
Created March 25, 2013 11:44
This code is used to generate an infinite scroll. It appends the new data to the container. Need to work on providing an animation when the data is being fetched.
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
// calling the function to get the ajax data
loadMore();
}
});
function loadMore() {
$.ajax({
url: base_url + "/infscroll/get_inf_scroll_ajax",
@amitavroy
amitavroy / MySQL for Telescope tables
Created June 4, 2019 08:52
Create the table for Telescope to work
CREATE TABLE `telescope_entries` (
`sequence` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`family_hash` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`should_display_on_index` tinyint(1) NOT NULL DEFAULT 1,
`type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`sequence`),