Skip to content

Instantly share code, notes, and snippets.

View dmahapatro's full-sized avatar

Dhiraj Mahapatro dmahapatro

View GitHub Profile
@sudharsans
sudharsans / PutResourcePolicy.py
Last active January 10, 2024 00:07
Resource Policy for CloudWatch Logs with CloudFormation - Route53 query log
import json
import cfnresponse
import boto3
from botocore.exceptions import ClientError
client = boto3.client("logs")
def PutPolicy(arn,policyname):
response = client.put_resource_policy(
policyName=policyname,
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@antony
antony / AngularJsAware.groovy
Last active February 11, 2020 15:12
Make Geb work with AngularJS reliably, by waiting for the angular views to be resolved before attempting assertions. This uses the same onReady technique as Protractor.
package extensions
trait AngularJsAware {
boolean isAngularReady() {
js.exec('window.MYAPP.waitForAngular();');
waitFor {
js.MYAPP.APP_READY == true
}
@CaptainOfFlyingDutchman
CaptainOfFlyingDutchman / external_configuration_in_grails_3.md
Last active September 23, 2019 09:19
Enable external configuration in Grails 3

External configuration in Grails 3


Working on Grails 3 I realized that I no longer can specify external configuration using the standard grails.config.locations property in Config.groovy file.

Reason is obvious! There is no Config.groovy now in Grails 3. Instead we now use application.yml to configure the properties. However, you can't specify the external configuration using this file too!

What the hack?

Now Grails 3 uses Spring's property source concept. To enable external config file to work we need to do something extra now.

@graemerocher
graemerocher / migrate-jira-to-github-issues.groovy
Last active March 26, 2024 00:09
JIRA to Github Issues Migration Script
@Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='1.1.0')
@Grab(group='joda-time', module='joda-time', version='2.7')
import wslite.rest.*
import org.joda.time.*
import org.joda.time.format.*
import groovy.xml.*
import groovy.json.*
import static java.lang.System.*
import groovy.transform.*
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@timyates
timyates / forceOverrideTraits.groovy
Last active October 21, 2015 04:25
Messing with groovy traits
// Bad example of @ForceOverride... enjoy! (?)
import groovy.transform.*
class BasicIntQueue extends LinkedList<Integer> {
Integer get() {
this.poll()
}
void put( Integer x ) {
@graemerocher
graemerocher / boot-gorm-mongodb.groovy
Last active December 24, 2015 03:11
Using GORM for MongoDB in Spring Boot
@Grab("org.grails:gorm-mongodb-spring-boot:1.0.0.RC1")
import grails.persistence.*
import grails.mongodb.geo.*
import org.bson.types.ObjectId
import com.mongodb.BasicDBObject
import org.springframework.http.*
import org.springframework.beans.factory.annotation.Autowired
import static org.springframework.web.bind.annotation.RequestMethod.*
@RestController
@johnrengelman
johnrengelman / build.gradle
Last active December 16, 2015 07:39
Building Grails 2.2.1 with Gradle, with Spock testing and Codenarc and some extra tasks to mimic Java/Groovy projects in Gradle
import org.grails.gradle.plugin.GrailsTask
apply plugin: 'grails'
grails {
grailsVersion '2.2.1'
}
buildscript {
repositories {
@anantn
anantn / firebase_detect_data.js
Created December 18, 2012 00:54
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');