Skip to content

Instantly share code, notes, and snippets.

View rahul-lohra's full-sized avatar
🎯
Focusing

Rahul Kumar Lohra rahul-lohra

🎯
Focusing
View GitHub Profile
@rahul-lohra
rahul-lohra / SparkButton.java
Last active March 12, 2017 21:16
Callbacks for animation in com.varunest.sparkbutton library
package com.varunest.sparkbutton;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
@rahul-lohra
rahul-lohra / git-ignore.sh
Created March 31, 2018 10:09 — forked from jeffjohnson9046/git-ignore.sh
Remove unwanted files from a git repo AFTER adding a .gitignore. The files will remain on disk.
## I just ran into this after initializing a Visual Studio project _before_ adding a .gitignore file (like an idiot).
## I felt real dumb commiting a bunch of files I didn't need to, so the commands below should do the trick. The first two commands
## came from the second answer on this post: http://stackoverflow.com/questions/7527982/applying-gitignore-to-committed-files
# See the unwanted files:
git ls-files -ci --exclude-standard
# Remove the unwanted files:
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
@rahul-lohra
rahul-lohra / App.dart
Created May 25, 2019 20:10
Dart callback
main(List<String> args) {
Button btn = new Button();
btn.setCallback((a){
print(a);
});
for(int i=0;i<4;++i){
btn.tap();
}
}
@rahul-lohra
rahul-lohra / AppButton.dart
Created August 12, 2019 02:34
Stack GestureDetector
import 'package:fix_library_app/RevealWidget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
class AppButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return nestedWidget();
}
@rahul-lohra
rahul-lohra / plugin.xml
Last active July 18, 2020 13:09
Plugin development
<idea-plugin>
<id>com.awesome.formatter</id> <!--Enter your package, it should be unique-->
<name>Awesome GQL Formatter</name>
<vendor email="tgunix@gmail.com" url="http://www.rahullohra.com">RahulLohra</vendor>
<description><![CDATA[
Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum.<br>
Lorem ipsum
]]></description>
@rahul-lohra
rahul-lohra / GqlView.java
Created July 18, 2020 13:14
GqlView Starter java code
package com.rahul.gqlformat;
import com.intellij.openapi.project.Project;
import javax.swing.*;
public class GqlView {
private JTextArea textArea;
private JButton btnImport;
private JPanel panel;
private JTextField tfVariableName;
@rahul-lohra
rahul-lohra / MyToolWindow.kt
Created July 18, 2020 13:58
MyToolWindow code
package com.rahul.gqlformat
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.ui.content.ContentFactory
class MyToolWindow : ToolWindowFactory {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
@rahul-lohra
rahul-lohra / plugin.xml
Created July 18, 2020 14:15
Register your toolwindow
</idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<toolWindow
id="Gql Format" anchor="right" factoryClass="com.rahul.gqlformat.MyToolWindow">
</toolWindow>
</extensions>
</idea-plugin>
@rahul-lohra
rahul-lohra / EditorLogic.kt
Last active July 19, 2020 03:41
Logic for reading value from variable defined in kt file
class EditorLogic {
val nodeCreator = NodeCreator()
var expressionElement: PsiElement? = null
fun selectCurrentFile(variableName: String, project: Project, textArea: JTextArea) {
reset()
val fileEditorManager = FileEditorManager.getInstance(project)
val virtualFile = fileEditorManager.openFiles