Skip to content

Instantly share code, notes, and snippets.

View bantya's full-sized avatar
🎯
Focussing

Rahul Thakare bantya

🎯
Focussing
  • http://127.0.0.1:4200
  • http://127.0.0.1:8080
  • 12:57 (UTC +05:30)
  • X @rkkth
View GitHub Profile
@bantya
bantya / bookmarked.php
Created October 21, 2016 04:21 — forked from xeoncross/bookmarked.php
Simple, PHP-based bookmark system so you can save internet pages. Uses HTTP Digest for Auth and PDO-SQLite extension (built-in).
<?php
// Place the DB files outside of the public web directory so people don't download it!
define('DB', 'links.sq3');
// Number of seconds a user must wait to post another link (false to disable)
define('WAIT', false);
// Should we enforce IP checking? (false to disable)
define('IP_CHECK', false);
@bantya
bantya / auto_relation.php
Created October 21, 2016 05:03 — forked from xeoncross/auto_relation.php
Make every record returned by PDO an ORM class that can load it's own relations. This is just a simple concept idea. The record objects can figure out what table they belong to from their keys and what we know of the schema.
<?php
define('START_TIME', microtime(TRUE));
register_shutdown_function(function() {
print dump(round(microtime(TRUE) - START_TIME, 3) . ' seconds');
print dump(round(memory_get_peak_usage() / 1024) . " kb peak usage");
print dump(DB::$q);
});
@bantya
bantya / markdown_limited.php
Last active October 21, 2016 08:47 — forked from xeoncross/example.php
Markdown Limited - a small, fast, safe markdown function in PHP
<?php
/**
* Parse the text with *limited* markdown support.
*
* @param string $text
* @return string
*/
function markdown_limited($text)
{
// Make it HTML safe for starters
@bantya
bantya / mb_substr_replace.php
Created January 24, 2017 07:40 — forked from stemar/mb_substr_replace.php
Multibyte substr_replace(). The mbstring library doesn’t come with a multibyte equivalent of substr_replace(). This function behaves exactly like substr_replace() even when the arguments are arrays.
<?php
function mb_substr_replace($string, $replacement, $start, $length=NULL) {
if (is_array($string)) {
$num = count($string);
// $replacement
$replacement = is_array($replacement) ? array_slice($replacement, 0, $num) : array_pad(array($replacement), $num, $replacement);
// $start
if (is_array($start)) {
$start = array_slice($start, 0, $num);
foreach ($start as $key => $value)
@bantya
bantya / _vimrc
Last active April 23, 2017 11:59
Vim: My _vimrc file
" vim: foldmethod=marker
:set nocompatible "For latest settings/options
" execute pathogen#infect()
" ####### Load external files ####### {{{1
" Load the vundle plugins file
so $HOME\plugins.vim
" Load defined support functions
so $HOME\partials\functions.vim
@bantya
bantya / plugins.vim
Last active April 23, 2017 11:59
Vim: My Vundle file
filetype off " required
set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
call vundle#begin('$VIM/vimfiles/bundle/')
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-vinegar'
Plugin 'scrooloose/nerdtree'
Plugin 'itchyny/lightline.vim'
Plugin 'vim-syntastic/syntastic'
@bantya
bantya / functions.vim
Last active April 23, 2017 11:59
Vim: My custom functions file
function! <SID>StripTrailingWhitespaces()
"Get the save last search and cursor position
let _s=@/
let l = line('.')
let c = col('.')
"Strip trailing whitespaces
%s/\s\+$//e
"Restore prev search history and cursor location
let @/=_s
call cursor(l, c)
@bantya
bantya / sublime_fonts.txt
Last active April 23, 2017 11:59
Sublime: Best fonts for Sublime Text
Fira Code
Monaco
Hack
CamingoCode
Source Code Pro
Consolas
Input
Inconsolata
Cousin
PT Mono
@bantya
bantya / Side Bar.sublime-menu
Last active April 23, 2017 11:58
Sublime: My SidebarEnhancements sublime text sidebar menu file
[
{
"caption": "aaaaa_side_bar",
"id": "aaaaa_side_bar",
"command": "aaaaa_side_bar",
"args": {
"paths": []
}
},
{
@bantya
bantya / gcl.bat
Created April 23, 2017 11:55
Git: Simple git clone helper for windows batch shell
@echo off
rem http://stackoverflow.com/questions/7005951/batch-file-find-if-substring-is-in-string-not-in-a-file
set url=%1
set location=%2
echo %url% | find /I ".git">Nul
if errorlevel 1 (
set url=%url%.git