Skip to content

Instantly share code, notes, and snippets.

View Abhinav1217's full-sized avatar

Abhinav Kulshreshtha Abhinav1217

View GitHub Profile
@Abhinav1217
Abhinav1217 / Fetch.sublime-settings.json
Last active January 18, 2020 12:14
My nettuts fetch sublime setting file
{
"files":
{
"Angular JS": "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.js",
"Backbone.js": "http://backbonejs.org/backbone.js",
"CSS-reset": "http://meyerweb.com/eric/tools/css/reset/reset.css",
"Chart.js": "https://raw.githubusercontent.com/nnnick/Chart.js/master/Chart.min.js",
"Exoskeleton": "https://github.com/paulmillr/exoskeleton/releases/download/0.6.3/exoskeleton.min.js",
"Favicon.js": "https://raw.githubusercontent.com/ejci/favico.js/master/favico-0.3.5.min.js",
"HTML5_SQL.js": "http://html5sql.com/js/html5sql.js",
@Abhinav1217
Abhinav1217 / javascript: getDateRangeOfWeek.js
Last active January 20, 2022 08:42
Get date range based on week number.
/**
* Get the date and days within a week from week number.
* eg: date range for 8th week in 2013 is 17th Feb to 23rd Feb. This
* code snippet will give you.
*
* It is not my code completely, Bit of modification from something
* i found on net. Cant find it anymore so keeping a backup.
*
* @param {[Integer]} weekNo [From week 1 to Week 52/53 based on the system date setting]
* @return {[Date]} [description]
@Abhinav1217
Abhinav1217 / Demo: Selecting First Child.html
Last active December 14, 2015 10:28
# Demo for different methods of selecting the first child element
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<title>Demo For first child item</title>
<style>
@Abhinav1217
Abhinav1217 / PHP: better_print_r.php
Last active December 15, 2015 21:29
A Better alternative to PHP print_r() function.
<?php
/**
* This function is an alternative to default PHP print_r() function.
* it displays the output as a recursive list items with highlighted key and values.
*/
function pp($arr){
$retStr = '<ul>';
if (is_array($arr)){
foreach ($arr as $key=>$val){
if (is_array($val)){
server {
listen 80;
server_name www.example.com;
root /var/www/vhosts/example.com/public/;
location /
{
index index.php index.html index.htm;
}
@Abhinav1217
Abhinav1217 / GetEnumValuesFromMySQL.php
Last active December 21, 2015 14:18
Get enum values from some column in Mysql/Mariadb with PHP or PDO
<?php
/** This snippet can be used as <options> in <SELECT> in html **/
?>
<select>
<?php
$result = mysql_query('SHOW COLUMNS FROM '.$table_name.' WHERE field="'.$column_name.'"');
while ($row = mysql_fetch_row($result)) {
foreach(explode("','",substr($row[1],6,-2)) as $option) {
print("<option>$option</option>");
@Abhinav1217
Abhinav1217 / PHPMinify.php
Last active August 29, 2015 14:27
A simple php script to Minify PHP files in PHP project using PHP shell command in terminal..
<?php
/**
* @author Abhinav Kulshreshtha
* @version 1.0
* @copyright 2015-End_of_Time Abhinav Kulshreshtha
* @license DO WHAT THE F**K YOU WANT TO PUBLIC LICENSE < http://www.wtfpl.net/ >
*
* @todo Looks Like I missed managing symlinks.
*/
@Abhinav1217
Abhinav1217 / stickyTitles.js
Created December 17, 2015 18:21 — forked from andrewlaskey/stickyTitles.js
Sticky Instagram-like Headers
//http://stackoverflow.com/questions/13279725/getting-a-sticky-header-to-push-up-like-in-instagrams-iphone-app-using-css-a
function stickyTitles(stickies) {
this.load = function() {
stickies.each(function(){
var thisSticky = jQuery(this).wrap('<div class="followWrap" />');
thisSticky.parent().height(thisSticky.outerHeight());
/**
* Add a getWeek() method in Javascript inbuilt Date object.
* This function is the colsest I could find which is ISO-8601 compatible. This is what php's `Date->format('w')` uses.
* ISO-8601 means.
* Week starts from Monday.
* Week 1 is the week with first thurday of the year or the week which has 4th jan in it.
* @param {[Date]} Prototype binding with Date Object.
* @return {[Int]} Integer from 1 - 53 which denotes the week of the year.
*/
@Abhinav1217
Abhinav1217 / FirefoxConfigChanges.md
Last active March 17, 2023 05:03
Firefox Enhancements

This is the firefox about:config changes for my conveniences on Linux systems.

  • To disable closing with last tab.

    • Set browser.tabs.closeWindowWithLastTab to false . Search for lasttab
  • To enable magnate link recognation.

    • Create new boolean with network.protocol-handler.expose.magnet and set it to false, It will ask which program to use.
  • If you need to choose the file, Binerie are located at /usr/bin/tixati.