Skip to content

Instantly share code, notes, and snippets.

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

Vinay Aggarwal vinaydotblog

🏠
Working from home
View GitHub Profile
@vinaydotblog
vinaydotblog / number_format.coffee
Created October 24, 2013 07:18
Number Format : Formatting a given number into million format upto 2 decimals.
number_format = (num) ->
dot = (num = num + "").indexOf(".")
if dot is -1
dot = num.length
num = num + ".00"
last = num.substr(dot).substr(0,3)
first = num.substr(0, dot)
rem = first.length % 3
middle = first.substr(rem)
first = first.substr(0, rem)
@vinaydotblog
vinaydotblog / composer-install.sh
Last active April 17, 2023 11:08
Installing composer using curl
# Goto a directory you can write to:
cd ~
#get composer:
curl -s https://getcomposer.org/installer | php
# move composer into a bin directory you control:
sudo mv composer.phar /usr/local/bin/composer
# double check composer works
composer about
@vinaydotblog
vinaydotblog / dir_search.php
Created September 10, 2013 16:45
Recusively search for a 'keyword' in directory using php
<?php // require '/var/www/vinay/node/chat/error.php';
$dir = '/var/www/bgd_admin/app/models';
$what = 'quote';
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@vinaydotblog
vinaydotblog / type.effect.html
Created June 30, 2013 18:14
Script to give typing effect to the given string.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body { background: #f6f6f6; }
textarea { width: 100%; border: 1px inset #ddd; padding: 5px; font-family: sans-serif; background: #f9f9f9; }
textarea:focus { outline: 2px solid #25547b; border-radius: 5px; }
</style>
@vinaydotblog
vinaydotblog / gist:5849407
Created June 24, 2013 11:31
Share page link for social networking sites
<?php
$linked_in = 'http://www.linkedin.com/shareArticle?mini=true&url=';
$facebook = 'https://www.facebook.com/sharer/sharer.php?u=';
$twitter = 'https://mobile.twitter.com/home?status=';
$link = $twitter . urlencode('http://www.briangavindiamonds.com/diamonds/diamond-details/0.822-g-vs2-round-diamond-ags-104063637016');
.text-shadow (@string: 0 1px 3px rgba(0, 0, 0, 0.25)) {
text-shadow: @string;
}
.box-shadow (@string) {
-webkit-box-shadow: @string;
-moz-box-shadow: @string;
box-shadow: @string;
}
.drop-shadow (@x: 0, @y: 1px, @blur: 2px, @spread: 0, @alpha: 0.25) {
-webkit-box-shadow: @x @y @blur @spread rgba(0, 0, 0, @alpha);
@vinaydotblog
vinaydotblog / Blank Image URI
Last active December 15, 2015 16:39
Valid Blank image URI
# Transparent
data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==
# White
data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==
@vinaydotblog
vinaydotblog / gist:5181462
Created March 17, 2013 13:16
SCSS mixin to easily include google webfonts.
@mixin webfont($font : list of items)
{
$url: "//fonts.googleapis.com/css?family=";
$font : unquote($font);
$i : 0;
@each $word in $font {
$i : $i + 1;
$url : $url + $word;
@if( $i < length($font) ){
<h1>Flickr Loading Animation</h1>
<div class="loader">
<i class="dot-pink"></i>
<i class="dot-blue"></i>
</div>
<p>…as seen in the new Flickr iOS app.</p>