Skip to content

Instantly share code, notes, and snippets.

View sagrawal31's full-sized avatar
🧑‍💻
😊

Shashank Agrawal sagrawal31

🧑‍💻
😊
View GitHub Profile
@sagrawal31
sagrawal31 / url-wrapper-test.ts
Last active December 27, 2019 10:30
A simple wrapper in TypeScript to easily parse & handle the URL
const url = new URLWrapper('https://example.com/?foo=bar&name=undefined&age=3');
console.log(url.getParam('foo') === 'bar');
console.log(url.getParam('name') === undefined);
console.log(url.getParam('age') === '3');
@gummiforweb
gummiforweb / slack-cleaner.js
Last active August 12, 2022 11:51 — forked from firatkucuk/delete-slack-messages.js
Clean up your Slack messages or files from either public channel, private channel, private message or group message. Fully interactive.
/**
* User Defined Values
*/
const agreedDisclaimer = false;
const apiToken = '';
/**
* Dont need to touch anything below
*/
const readline = require('readline');
@tterb
tterb / README-badges.md
Last active May 14, 2024 09:43
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@sagrawal31
sagrawal31 / grails
Created March 9, 2017 09:16
Auto use Grails 3 versions from gradle.properties
#!/usr/bin/env bash
set -e
# Handy script to auto use the Grails 3 version based on what is defined in the "gradle.properties". This script uses
# the Grails installed by the famous SDKMan so it will look the Grails installation at "~/.sdkman/candidates/grails"
# so only make sure the particular Grails version is installed using "sdk install grails <version>".
#
# The only thing to care about is that this script should be included first in the "PATH" before the
# ".sdkman/candidates/grails/current" is included.
#
@sagrawal31
sagrawal31 / formatSeconds.groovy
Created February 24, 2017 10:53
A simple Java/Groovy code to convert a given seconds value to hh:mm:ss format
import java.util.concurrent.TimeUnit
void convert(int secondsToConvert) {
long millis = secondsToConvert * 1000;
long hours = TimeUnit.MILLISECONDS.toHours(millis);
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1);
long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1);
String format = String.format("%02d:%02d:%02d", Math.abs(hours), Math.abs(minutes), Math.abs(seconds));
yum install -y libpng
yum install -y libjpeg
yum install -y openssl
yum install -y icu
yum install -y libX11
yum install -y libXext
yum install -y libXrender
yum install -y xorg-x11-fonts-Type1
yum install -y xorg-x11-fonts-75dpi
@lopspower
lopspower / README.md
Last active May 17, 2024 04:22
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@sagrawal31
sagrawal31 / DownloadURLs.groovy
Last active May 4, 2022 10:10
A simple Groovy script to scrape all URLs from a given string and download the content from those URLs
import java.util.regex.Matcher
import java.util.regex.Pattern
Pattern urlPattern = Pattern.compile("\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]",Pattern.CASE_INSENSITIVE);
String urlString = """This is a big string with lots of Image URL like: http://i.istockimg.com/file_thumbview_approve/69656987/3/stock-illustration-69656987-vector-of-flat-icon-life-buoy.jpg and
http://i.istockimg.com/file_thumbview_approve/69943823/3/stock-illustration-69943823-beach-ball.jpg few others below
http://i.istockimg.com/file_thumbview_approve/40877104/3/stock-photo-40877104-pollen-floating-on-water.jpg
http://i.istockimg.com/file_thumbview_approve/68944343/3/stock-illustration-68944343-ship-boat-flat-icon-with-long-shadow.jpg
"""
@claybridges
claybridges / xcbuild-safe.sh
Last active September 26, 2018 18:21
Drop in replacement/wrapper for xcodebuild, fixes Xcode 7 build dependency on system ruby vs. rvm. Explained further @ http://stackoverflow.com/questions/33041109.
#!/bin/bash --login
# Cf. http://stackoverflow.com/questions/33041109
#
# Xcode 7 (incl. 7.0.1) seems to have a dependency on the system ruby.
# xcodebuild is screwed up by using rvm to map to another non-system
# ruby†. This script is a fix that allows you call xcodebuild in a
# "safe" rvm environment, but will not (AFAIK) affect the "external"
# rvm setting.
#
@clipperhouse
clipperhouse / SublimeHere.md
Last active January 1, 2020 10:35
Open Sublime Text in current Finder folder

First you need subl at the command line. Use this:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

...which came from Sublime's documentation here.

Next, open (Apple)Script Editor and paste this in:

tell application "Finder"