Skip to content

Instantly share code, notes, and snippets.

View radjivF's full-sized avatar
🐢
doing some stuff

radjivF radjivF

🐢
doing some stuff
View GitHub Profile
@radjivF
radjivF / hideExpressHeaderHttpRequest.js
Last active October 26, 2015 17:15
hide Express Header in Http Request
app.use(function (req, res, next){
res.set('X-Powered-By', 'NameApplication');
next();
}
@radjivF
radjivF / run.js
Created October 27, 2015 13:16
use a node as command line
#!/usr/bin/env node
@radjivF
radjivF / delete_array_test.js
Last active February 16, 2016 00:34
delete in an Array with protractor
it "delete in an Array" , ->
element.all(By.repeater('a in Array.list')).count()
.then (@number_of_rows_before) ->
element.all(By.css('i.fa.fa-chevron-up')).last().click()
element.all(By.css('a.glyphicon.glyphicon-trash')).last().click()
.then () ->
waitForAlert()
.then () ->
browser.switchTo().alert().accept()
handlebars.registerHelper 'json', (context) ->
JSON.stringify context
handlebars.registerHelper 'debug', (value) ->
console.log 'Current Context'
console.log '===================='
console.log this
if value
console.log 'Value'
console.log '===================='
@radjivF
radjivF / conditional_promise.coffee
Created June 14, 2016 08:20
conditional promise in coffeescript
conditional = true
promises_list = []
if conditional?
#if conditional is true run this promises
p.push Promise.conditional conditional
p.push Promise.normal
Promise.all p
@radjivF
radjivF / crazy_filter.js
Last active September 8, 2016 07:16
crazy_filter
var supporting_docs;
if (claim_id) {
supporting_docs = supporting_docs.filter(function(cla) {
return cla.claim_id <= claim_id && (my_role === 'CLAIMANT' && cla.claim_status === 'SUBMITTED' ? cla.created_at < cla.claim_submitted_at : true);
});
}
@radjivF
radjivF / my-linter
Created January 4, 2018 02:56
Personal linter based on airbnb guideline
{
"extends": [
"eslint:recommended", "plugin:react/recommended", "airbnb"
],
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
@radjivF
radjivF / avoidenterfireringpreviousparent.js
Created March 1, 2018 01:51
enter key trigger parent element by default
$(event.currentTarget).on("keypress", function(event){
if(event.keyCode ===13){
var e = $.Event("focusout");
$(event.currentTarget).trigger(e);
event.preventDefault;
return false;
}
})
#!/bin/sh
old=radjivC
new=radjivF
git remote -v | grep $old | while read name url type; do
newurl=`echo $url | sed -e "s/$old/$new/"`
git remote set-url $name $newurl
done
@radjivF
radjivF / product.liquid
Last active July 8, 2018 08:24
accordion for shopify product page
{% comment %}
<!--
Liquid will output content, split on h3s like this:
<div class="accordion">
<h5><a href="#free-shipping" data-accordian-action>Free & Fast USA Shipping <span>+</span></a></h5>
<p id="free-shipping" data-accordian-target>All orders are shipped through USPS. We pride ourselves on fast delivery. Orders typically arrive within 2-5 business days. You will receive an email with tracking information when your order is ready to ship.</p>
<h5><a href="#international-shipping" data-accordian-action>International Shipping <span>+</span></a></h5>
<p id="international-shipping" data-accordian-target>International shipping rates vary based on item(s). Shipping rates can be seen on the checkout page. International orders typically arrive within 7-10 business days, but can vary with customs clearance in each country. </p>
</div>