Skip to content

Instantly share code, notes, and snippets.

View dhavaln's full-sized avatar
💭
I may be slow to respond.

Dhaval Nagar dhavaln

💭
I may be slow to respond.
View GitHub Profile
@megafaunasoft
megafaunasoft / povray_lambda.js
Created February 2, 2015 21:23
Using AWS Lambda and povray to render images
var async = require('async');
var AWS = require('aws-sdk');
var util = require('util');
var spawn = require('child_process').spawn;
var fs = require('fs');
var s3 = new AWS.S3();
// globals
var dstBucket = "outrender1121"
@martinmidtsund
martinmidtsund / heroku-deploy
Last active April 3, 2017 09:52
Script for deploying a Meteor.js application to Heroku. The script will create a new application on Heroku with the given APPNAME, and add a MongoHQ addon, with the Sandbox plan(free plan with 512 MB MongoDB). It will then deploy your Meteor.js app to heroku.
#!/bin/bash
# Deploy script for Meteor.js to Heroku
#
# Author: Martin A. Midtsund / martin@iterate.no
#
# Before running this script, you need to have these tools in your path:
# meteor - To install: $ curl https://install.meteor.com | sh
# heroku - Install Heroku toolbelt and log in to your user: https://toolbelt.heroku.com/
# git - You'll get this in the Heroku toolbelt, if you don't already have it.
#
@allenhwkim
allenhwkim / gist:be508558869f322e7697
Created October 22, 2014 14:48
Angular Google Maps Fit Bounds
<!doctype html>
<html ng-app="myapp">
<head>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script src="http://code.angularjs.org/1.2.25/angular.js"></script>
<script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.js"></script>
<script>
var app = angular.module('myapp', ['ngMap']);
app.controller('MyCtrl', function($scope) {
$scope.positions = [ [-24,132] ,[-25,131] ,[-26,130] ];
@ifraixedes
ifraixedes / LICENSE
Last active May 6, 2018 06:44
AWS lambda handler which download images from S3, resizes them and upload the new ones to S3; tested with mocha, chai, sinon and proxyquire
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
(http://www.wtfpl.net/about/)
Copyright (C) 2015 Mario Mendes (@hyprstack)
Copyright (C) 2015 Ivan Fraixedes (https://ivan.fraixed.es)
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@PomepuyN
PomepuyN / SettingsAdapter.java
Last active June 5, 2018 09:02
Functional example of WearableListView
public class SettingsAdapter extends WearableListView.Adapter {
private final Context context;
private final List<SettingsItems> items;
public SettingsAdapter(Context context, List<SettingsItems> items) {
this.context = context;
this.items = items;
}
@codeshrew
codeshrew / open-chrome-disable-web-security.scpt
Last active March 31, 2019 22:27
Launches Google Chrome with web security disabled. This disables the same origin policy for API calls and can ease development from a dev environment not in a server's CORS settings
(* Launches Google Chrome with web security disabled.
This disables the same origin policy for API calls and can
ease development from a dev environment not in a server's CORS settings *)
(* This same command can be sent to Canary by changing
'Google Chrome.app' to 'Google Chrome Canary.app' *)
do shell script "open -a 'Google Chrome.app' --args --disable-web-security --allow-running-insecure-content"
(* If you want to not use your current user in Chrome you can set --user-data-dir to point to /tmp

[based on a true story]

So. Your friend's about to teach you how to make a website. Great!

You make a file, and you save it as 'index.html'. Why it's called 'index' isn't really explained to you, but whatever.

You type the following.

hello world
@pbolduc
pbolduc / 1. Install Redis
Last active July 3, 2023 09:39 — forked from nghuuphuoc/1) Install
Install redis on CentOS 7
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@nilcolor
nilcolor / Node.js CORS
Created February 8, 2011 15:28
Node.js cross-origin POST. You should response for OPTIONS request first. Something like this.
if (req.method === 'OPTIONS') {
console.log('!OPTIONS');
var headers = {};
// IE8 does not allow domains to be specified, just the *
// headers["Access-Control-Allow-Origin"] = req.headers.origin;
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
headers["Access-Control-Allow-Credentials"] = false;
headers["Access-Control-Max-Age"] = '86400'; // 24 hours
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
@kmaida
kmaida / dynamicPagRepeatAngular.html
Last active December 13, 2023 14:37
AngularJS - Dynamic pagination on ng-repeat with search/filtering. Use with ui.bootstrap
<!DOCTYPE HTML>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>Dynamic Pagination w/ Filtering</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Kim Maida">
<!-- JS Libraries -->