Skip to content

Instantly share code, notes, and snippets.

const element = <h1>Hello World</h1>;
debugger;
ReactDOM.render(
element,
document.getElementById('fitment-widget-div')
);
##GeoViz
(Arun Ganesh)[https://en.wikipedia.org/wiki/User:Planemad]
(Sajjad Anwar)[https://geohacker.in/]
##OpenData
(Thejesh GN)[https://thejeshgn.com/]
##DataJournalism
(Avinash Celestine)[http://datastories.in]
<span>{{group.members_count}} <ng-pluralize count='group.members_count'.
when="{'1': 'Member',
'other':'Members'}"></span>
@djds4rce
djds4rce / gist:6755530
Last active December 24, 2015 06:09
Understanding functional
variable_storing_a_function = Proc.new {|arg1,arg2| puts "First Argument : #{arg1}\nSecond Arguemt #{arg2}"}
variable_storing_a_function.call(1,2)
def an_example_function(variable1,variable2,&block)
sum = variable1+variable2
block.call(sum)
end
<html class="no-js">
<head>
<title></title>
</head>
<body ng-app>
<h1>Model Binding Example| Hello World</h1>
<p>{{helloworld}}</p>
<input type='text' ng-model='helloworld'></input>
<script src="angular.js"></script>
// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('MyHttpInterceptor', function ($q) {
return {
// On request success
request: function (config) {
// console.log(config); // Contains the data about the request before it is sent.
@djds4rce
djds4rce / requestInterceptor.js
Created August 13, 2013 17:05
A Angular Request Interceptor which modifies the configuration object to add auth token to url params of every http call to api server
//Works for 1.1.x versions. 1.0.x is similar and can be figured out using code comments
myapp.factory('httpRequestInterceptor', function ($cookieStore) {
return {
request: function (config) {
var token = $cookieStore.get("auth");
config.url = URI(config.url).addSearch({'_auth_token':token}).toString();
return config;
}
};
@djds4rce
djds4rce / responseInterceptor.js
Last active December 21, 2015 00:49
Http Response interceptor. Handles 401 requests from the server
//Works for 1.1.x versions. 1.0.x is similar and can be figured out using code comments
myapp.factory('myHttpResponseInterceptor',['$q','$location',function($q,$location){
return {
response: function(response){
return promise.then(
function success(response) {
return response;
},
function error(response) {
if(response.status === 401){
class Hospital < ActiveRecord::Base
lambada :certified { where(:certified=>true).joins(:district) }
end
Hospital.scoped.certified
#This module does all the encryption and decryption using OpenSSL ruby class
module EncryptionEngine
#encrypt method as the name suggest encrypts 'data' using 'algorithm' with 'key'
def encrypt( data, key, algorithm)
#Do not encrypt if data is nil
if !data.nil? && !data.empty?
cipher = OpenSSL::Cipher::Cipher.new algorithm
cipher.encrypt