Skip to content

Instantly share code, notes, and snippets.

View arvindr21's full-sized avatar
💭
Meh

Arvind Ravulavaru arvindr21

💭
Meh
View GitHub Profile
<!--
-
- The below code will convert a ng-repeat which display 3 column like
- 1 | 2 | 3
- 4 | 5 | 6
- 7 | 8 | 9
- 10
- To
-
- 1 | 5 | 8
@garycrawford
garycrawford / docker-compose.yml
Created July 9, 2015 13:00
MongoDB Replica Set docker-compose.yml
primary:
image: mongo:3.0
volumes:
- ./p:/data
ports:
- "27017:27017"
# Our current version of docker-compose doesn't allow extra_hosts which would be the best way
# to add curcular dependency container links in this case. We cant upgrade docker-compose
# without upgrading docker to 1.7, and we can't do that without upgrading the kernel on our
# CentOS VM's. As such we are using the hostname hask below to allow primary and secondary
@abeisgoat
abeisgoat / ImageUpload.js
Last active January 30, 2020 15:54
An example of image uploading using Firebase with AngularFire.
angular.module('app')
.controller('ImageUpload', ['$scope', '$log',
function ImageUpload($scope, $log) {
$scope.upload_image = function (image) {
if (!image.valid) return;
var imagesRef, safename, imageUpload;
image.isUploading = true;
imageUpload = {
@debreczeni
debreczeni / git-show-big-files.sh
Created May 2, 2012 16:41
Find large files in git repository
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
@kn9ts
kn9ts / inAppBrowserExample.js
Last active August 6, 2020 02:35
An InAppBrowser instance example
var browser = cordova.InAppBrowser.open('http://amazon.com?vitumob_session_id=13279njke12hjhuidhiush124hu', '_blank', 'location=no');
browser.addEventListener('loadstart', function(event) {
alert('Began loading this page: ' + JSON.stringify(event));
});
// event fires when the InAppBrowser finishes loading a URL.
browser.addEventListener('loadstop', function(event) {
// event => {type: 'loadstop', url: 'URL navigated to'}
// alert('InAppBrowser Event: ' + JSON.stringify(event));
@dominicsayers
dominicsayers / s3cmd_install.md
Created March 6, 2013 16:36
Installing s3cmd on Ubuntu Server
  1. sudo apt-get install python-setuptools
  2. wget http://downloads.sourceforge.net/project/s3tools/s3cmd/1.5.0-alpha1/s3cmd-1.5.0-alpha1.tar.gz
  3. tar xvfz s3cmd-1.5.0-alpha1.tar.gz
  4. cd s3cmd-1.5.0-alpha1
  5. python setup.py install
  6. s3cmd --configure
@paolorossi
paolorossi / async-task-queue.js
Last active December 17, 2021 04:36
Javascript Queue for sequencing AJAX requests and other asynchronous tasks. Demo http://jsfiddle.net/rusci/26Dud/6/
// Queue class for serializing AJAX calls.
//
// Inspired by Raynos http://stackoverflow.com/a/4797596/1194060
//
// Queue has a public append method that expects some kind of task.
// A task is a generic function passed as callback.
// Constructor expects a handler which is a method that takes a ajax task
// and a callback. Queue expects the handler to deal with the ajax and run
// the callback when it's finished
@ghalusa
ghalusa / default
Last active March 7, 2023 12:17
nginx default configuration file (ubuntu path: /etc/nginx/sites-available/default) with conversions of .htaccess environment variables and mod_rewrite logic, along with parameters supporting a fastcgi-based php setup
server {
listen 80;
root /var/www/YOUR_DIRECTORY;
index index.php index.html index.htm;
###################################################
# Change "yoururl.com" to your host name
server_name yoururl.com;
@adon-at-work
adon-at-work / multer-to-s3.js
Last active April 3, 2023 18:10
Sample File Upload From Multer to S3
var AWS = require('aws-sdk'),
fs = require('fs');
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk
AWS.config.loadFromPath('./aws-config.json');
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}});
function uploadToS3(file, destFileName, callback) {
@niemyjski
niemyjski / description.md
Last active June 8, 2023 15:33
Report Home Assistant Battery Levels With Node-RED

I decided to share this snippet based on seeing what others were doing in this thread: https://www.reddit.com/r/homeassistant/comments/emvk9y/how_do_you_monitor_sensor_battery_levels_looking/

Basically dome device types of battery report the state in different locations and with different string values that the change node or conditional logic just doesn't work nicely. Using the conditional logic on this string state value might not be working fully how we think it is or at least didn't for me. When I was debugging it and getting 10 outputted in a 100 bucket via the gt condition. The best way I've found to handle these conditions is with a function node.

Home Assistant Feedback