Skip to content

Instantly share code, notes, and snippets.

View tushar-borole's full-sized avatar
🎯
Working on React

Tushar Borole tushar-borole

🎯
Working on React
View GitHub Profile
#!/bin/bash
ax=`vnstat --oneline | awk -F ";" '{print $11}'`
if [[ "$ax" == *GiB* ]];
then
if [ $(echo "$(echo "$ax" | sed 's/ GiB//g') > 999"|bc) -eq 1 ]
then
shutdown -h now
fi
fi

SublimeText3 Valid License without cracking! Just download/install then use this license.

Notice that it may not work on dev builds, but still works on 3083 build!

----- BEGIN LICENSE -----

Andrew Weber
Single User License
EA7E-855605
813A03DD 5E4AD9E6 6C0EEB94 BC99798F
@tushar-borole
tushar-borole / traverse.js
Last active July 30, 2024 00:40 — forked from steinfletcher/traverse.js
Object tree traversal in javascript (with lodash)
var data = {
"name": "root",
"contents": [
{
"name": "A",
"contents": [
{
"name": "fileA1",
"contents": []
}
@tushar-borole
tushar-borole / checkImage.example.js
Created October 15, 2015 11:51 — forked from draeton/checkImage.example.js
Check the existence of an image file at `url` by creating a temporary Image element.
// Example Use
(function () {
function success() {
console.log("success: ", this.src);
}
function failure() {
console.log("failure: ", this.src);
}
@tushar-borole
tushar-borole / filter-blur.css
Created November 6, 2015 14:09
Cross-browser Filter Blur CSS
filter: blur(5px); /* Someday, sigh ... */
-webkit-filter: blur(5px); /* Prefixed CSS3 blur filters */
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
/* filter: url(#blur); Firefox needs SVG */
filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='10'); /* IE lte 9 */
//The connect.options.middleware is the relevant part
//Adapted from https://github.com/yeoman/generator-angular/issues/433#issuecomment-37706899
// Generated on 2014-01-30 using generator-angular 0.7.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
@tushar-borole
tushar-borole / Gruntfile.js
Created November 25, 2015 07:35 — forked from nnarhinen/Gruntfile.js
Support html5 pushState (or angular.js html5mode) in a yeoman (grunt-contrib-connect) application.
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
//MODIFIED: add require for connect-modewrite
var modRewrite = require('connect-modrewrite');
grunt.initConfig({
@tushar-borole
tushar-borole / image-aspect-ratio.js
Created December 1, 2015 20:14 — forked from jabranr/image-aspect-ratio.js
Set image aspect ratio with JavaScript
/**
* Originally wrote this snippet for Suffragette/Pathé campaign (https://apps.facebook.com/inspiring-women)
*
* The campaign app forms a grid of square images pulled from social APIs based on
* particular hashtags. This snippet sets the new width and
* height based on their natural width and height to maintain the aspect ratio.
* Works best for 1:1 aspect ratio but can be modified to accommodate other ratio.
*
* @param Element|Resource img - An image element/resource from DOM
* @param int expected - Expected width or height
<?php
/**
* Use * for origin
*/
add_action( 'rest_api_init', function() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' );
@tushar-borole
tushar-borole / iterm2-solarized.md
Last active July 19, 2018 17:56 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k