Skip to content

Instantly share code, notes, and snippets.

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

Sanjay Rohila crazyrohila

🏠
Working from home
View GitHub Profile
@hassy
hassy / lambda.js
Last active September 19, 2022 17:20
Different behavior of context.succeed() vs callback() in AWS Lambda
//
// Lambda's timeout needs to be >5 seconds, 10 should do
//
var startedAt = new Date();
var interval = setInterval(function () {
console.log(startedAt, new Date());
}, 1000);
@AlexSkrypnyk
AlexSkrypnyk / mymodule.css
Last active April 17, 2024 08:37
Drupal 'add more' and 'remove single' AJAX buttons on multi value custom field using FormAPI
input.form-submit.button-small {
padding: 4px 8px;
font-weight: bold;
}
.container-inline input.form-submit.button-small + .ajax-progress.ajax-progress-throbber .throbber {
position: absolute;
left: 19px;
margin-top: 7px;
}
@arpitr
arpitr / watchdog.php
Last active March 11, 2016 10:09
Drupal Watchdog Objects and Array
watchdog('module_name', 'Your Object: !object', array('!object' => '<pre>' . check_plain(print_r($object, TRUE)) . '</pre>'), WATCHDOG_ERROR);
@hitsujiwool
hitsujiwool / docker.json
Created September 15, 2015 06:20
docker + docker-compose on Amazon Linux
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"ssh_pty": true,
"access_key": "{{user `aws_access_key`}}",
@blackfalcon
blackfalcon / SassMeister-input-HTML.haml
Last active August 29, 2015 14:20
Generated by SassMeister.com.
.block
-(1..6).each do |i|
.element #{i}
@shrop
shrop / intro-meteor.js.md
Last active October 1, 2022 16:54
Introduction to Meteor.js
@vipickering
vipickering / closestNumberArray.js
Created September 13, 2013 15:42
Javascript: Find The Closest Number In Array To A Specific Value
var array = [];
function closest(array,num){
var i=0;
var minDiff=1000;
var ans;
for(i in array){
var m=Math.abs(num-array[i]);
if(m<minDiff){
minDiff=m;
@willurd
willurd / web-servers.md
Last active April 20, 2024 01:40
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@angryobject
angryobject / template.php
Last active July 3, 2018 01:00
Drupal 7 menu extra classes
<?php
/**
* This snippet adds extra classes to Drupal
* menu leafs (li tags) and menu itself (ul tags).
*/
/**
* Since the standart preprocess function for menu tree, which is
* template_preprocess_menu_tree, located in includes/menu.inc,
@coreyworrell
coreyworrell / gist:1313678
Created October 25, 2011 18:06
JW Player - Stop other videos when playing
(function($) {
/**
* We have to get a collection of id's because the HTML5 player moves the DOM
* around and returns different elements when caching the selectors.
*/
var elements = $('.video-player > div, .video-player object'),
playerIds = [];
elements.each(function(i, player) {
playerIds.push(player.id);