Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
Launched my first mac app –– Presentify

Ram rampatra

😇
Launched my first mac app –– Presentify
View GitHub Profile
@rampatra
rampatra / sof.swift
Created May 24, 2020
Show the window
View sof.swift
// Show Annotate Screen window and make it key
let window = annotateWindowController.window!
guard let screen = NSScreen.main else { return }
window.setFrame(screen.visibleFrame, display: true)
window.backgroundColor = NSColor.white.withAlphaComponent(0.001)
window.level = NSWindow.Level.popUpMenu
window.orderFrontRegardless()
window.makeKeyAndOrderFront(self)
@rampatra
rampatra / site.json
Last active Mar 15, 2020
Generate a json file with all the posts in your Jekyll website
View site.json
---
layout: null
---
[
{% for post in site.posts %}
{
"title" : "{{ post.title }}",
"url" : "{{ post.url }}",
"date" : "{{ post.date | date: "%b %d, %Y" }}",
@rampatra
rampatra / site.json
Last active Jan 30, 2020
Fetching all jekyll posts in a json
View site.json
---
layout: null
---
[
{% for post in site.posts %}
{
"title" : "{{ post.title }}",
"url" : "{{ post.url }}",
"date" : "{{ post.date | date: "%B %d, %Y" }}",
@rampatra
rampatra / XHR.js
Created Apr 13, 2016
Generic XML Http Request method in javascript
View XHR.js
function xhr(method, uri, body, handler) {
var req = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
req.onreadystatechange = function ()
{
if (req.readyState == 4 && handler)
{
eval('var o=' + req.responseText);
handler(o);
}
}
@rampatra
rampatra / ReverseAndAdd.java
Created Sep 17, 2015
Reverse, add and check for palindrome
View ReverseAndAdd.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
/**
* Created by IntelliJ IDEA.
*
* @author: ramswaroop
* @date: 9/16/15
@rampatra
rampatra / Parenthesis.java
Created Sep 17, 2015
Well-formed Parenthesis
View Parenthesis.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.EmptyStackException;
/**
* Created by IntelliJ IDEA.
*
* @author: ramswaroop
* @date: 9/15/15
@rampatra
rampatra / 0_reuse_code.js
Created May 1, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.