Skip to content

Instantly share code, notes, and snippets.

View ajfmo's full-sized avatar
🎯
Focusing

Adrian Flores ajfmo

🎯
Focusing
View GitHub Profile
@ajfmo
ajfmo / Investigator.java
Created February 15, 2018 18:11 — forked from james-d/Investigator.java
Example of JPA entities that use JavaFX properties. These use a "super-lazy" idiom for instantiating the properties, and implement Externalizable to work around the lack of Serialization support in the FX property classes.
package edu.marshall.genomics.lims.entities;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
@iloveitaly
iloveitaly / suitescript_utilities.js
Last active February 22, 2024 21:52
Simple utilities to help ease NetSuite SuiteScript development
// Author <mike@suitesync.io>
function isUserInterfaceContext() {
var context = nlapiGetContext();
var executionContext = context.getExecutionContext();
return executionContext == 'userinterface';
}
function startsWith(str, searchString) {
@james-d
james-d / EditCell.java
Created February 13, 2015 03:18
(Fairly) reusable edit cell that commits on loss of focus on the text field. Overriding the commitEdit(...) method is difficult to do without relying on knowing the default implementation, which I had to do here. The test code includes a key handler on the table that initiates editing on a key press.
import javafx.event.Event;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
@james-d
james-d / DataAccessor.java
Created May 11, 2014 01:31
JavaFX client code for the Laboratory Information Management System demo. The key here is that the controller references a client-side data accessor, which uses a Jersey client to communicate with the web-based REST service.
package edu.marshall.genomics.lims.client;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@james-d
james-d / InvestigatorController.java
Last active March 12, 2018 12:33
Rest controllers for the Laboratory information management system. See also https://gist.github.com/james-d/ab72b487b7b12bb7a3bc
package edu.marshall.genomics.lims.web;
import java.util.List;
import javax.inject.Inject;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@james-d
james-d / Dao.java
Created May 11, 2014 01:21
Business model and data integration tier for the laboratory information management system. See also https://gist.github.com/james-d/e485ac525c71e20bb453
package edu.marshall.genomics.lims.data;
import java.util.List;
import edu.marshall.genomics.lims.entities.Investigator;
import edu.marshall.genomics.lims.entities.Project;
import edu.marshall.genomics.lims.entities.Sample;
public interface Dao {
public List<Investigator> getAllInvestigators() throws DaoException ;
@james-d
james-d / Investigator.java
Created May 11, 2014 01:15
Example of JPA entities that use JavaFX properties. These use a "super-lazy" idiom for instantiating the properties, and implement Externalizable to work around the lack of Serialization support in the FX property classes.
package edu.marshall.genomics.lims.entities;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@tehnrd
tehnrd / gist:4559623
Last active March 1, 2023 07:27
Getting values out of a JSON list of objects with Apex code.
List<Object> fieldList = (List<Object>)JSON.deserializeUntyped('[{"field":"phone","object":"account"},{"field":"name","object":"account"}]');
for(Object fld : fieldList){
Map<String,Object> data = (Map<String,Object>)fld;
//Magic!
system.debug(data.get('field'));
}