Skip to content

Instantly share code, notes, and snippets.

@ManishLSN
ManishLSN / Converter.class.php
Created November 22, 2017 12:07 — forked from gabrieljmj/Converter.class.php
Currency converter using Google API You must have the curl extension in PHP active.
<?php
/**
* @author @GabrielJMJ /twitter
* @description Abstract class to define a interface of a converter
* @link https://gist.github.com/GabrielJMJ/6977968 Gist on GitHub
**/
abstract class Converter{
protected $valueWithCurrency;
protected $toCurrency;
@ManishLSN
ManishLSN / webnotification.html
Created November 22, 2017 14:24
to show custom and predefined webnotification code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Web Notifications API Demo</title>
<style>
*
{
-webkit-box-sizing: border-box;
@ManishLSN
ManishLSN / setheaderbyangular.js
Created November 23, 2017 09:48
set header in angular for token
//$window.location.reload();
//$state.go("login");
$cookies.put("token", response.token);
var value = $cookies.get("token");
/* $cookies.put("loginUserId", response[0].id);
$rootScope.loginUserId = $cookies.get("loginUserId"); */
localStorageService.set("loginUserId", response.id);
@ManishLSN
ManishLSN / curlMethod.php
Created November 23, 2017 09:51
curl method in php
<?php
### function for curl ###
/* gets the data from a URL */
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
@ManishLSN
ManishLSN / tmux-cheatsheet.markdown
Created December 8, 2017 06:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<?php
/*$date = new DateTime('2017-12-21T01:30:00.0000000', new DateTimeZone('Asia/Kolkata'));
echo "Indian time:". $date->format("Y-m-d H:i:s P");echo "<br>";
$date->setTimeZone(new DateTimeZone('America/New_York'));
echo date('Y-m-d H:i:s', strtotime('2017-12-21T01:30:00.0000000') + (5.5 * 3600));*/
/*$a = function() {
echo 'hello world';
};
@ManishLSN
ManishLSN / commands
Created December 27, 2017 06:14
willl keep all usefull commands here
# for setting node path in windows
setx NODE_PATH "%NODE_PATH%;C:\Users\winbdows 7\AppData\Roaming\npm\node_modules"
@ManishLSN
ManishLSN / danger_cmd.sh
Created December 27, 2017 11:43
Most Dangerous command in Linux
There are plenty of one line terminal commands that can prove to be exorbitantly dangerous.
1. The Delete Everything Command
rm -rf /
This command deletes everything it possibly can, including files on your hard drive and files on connected removable media devices. This command can be explained as follows:
rm – Remove the following files.
-rf – Run rm recursively.
@ManishLSN
ManishLSN / setHeaderbyAngularjs.js
Created December 29, 2017 10:36
set header in angular js application
//$window.location.reload();
//$state.go("login");
$cookies.put("token", response.token);
var value = $cookies.get("token");
/* $cookies.put("loginUserId", response[0].id);
$rootScope.loginUserId = $cookies.get("loginUserId"); */
localStorageService.set("loginUserId", response.id);
@ManishLSN
ManishLSN / makeThumb.php
Created January 16, 2018 03:49
make thumb of image from the php functions
<!DOCTYPE html>
<html>
<body>
<center>
<form action="ab1.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="file"><br><br>
Desired width: <input type="text" name="desired_width"><br><br>
<input type="submit" value="Upload Image" name="submit">
</form>