Skip to content

Instantly share code, notes, and snippets.

View anataliocs's full-sized avatar
👨‍💻
Working with Soroban Rust smart contracts

Chris Anatalio anataliocs

👨‍💻
Working with Soroban Rust smart contracts
View GitHub Profile
@anataliocs
anataliocs / autoscroll.js
Created October 23, 2013 18:50
Scroll scrollable div within page to anchor link
$('html, body').animate({
scrollTop: $('#groupSpan'+id).offset().top
}, -100);
@anataliocs
anataliocs / clickevent.js
Created October 23, 2013 18:51
jQuery click event live
//Add click event
$('#firstTimeHandoutLink').live('click', function() {
openHandout();
});
@anataliocs
anataliocs / etc
Created October 23, 2013 18:58
Grails Servlet response REST IMPORTS
HTTPServletResponse.SC_OK
.findById(params.goalInfoId, [sort: "date", order: "desc"])
@anataliocs
anataliocs / dates.txt
Created October 23, 2013 19:00
SQL date conversions date range
WHERE DATE BETWEEN '09/16/2010 05:00:00' and '09/21/2010 09:00:00'
Convert SQL Server timestamp into date
CONVERT(char(10), Dateadd(second, (createStamp/1000), '01/01/1970'), 101) as Created
@anataliocs
anataliocs / javadates.java
Created October 23, 2013 19:03
Java dates date conversion
calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
String birthDate = (String)report.get("birthDateDay") + " " + (String)report.get("birthDateMonth") + " " + (String)report.get("birthDateYear");
SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy");
ageVal = new Date().getTime() - sdf.parse(birthDate).getTime();
ageVal /= 31536000000l; // covert milliseconds to years
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("EST5EDT"));
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
sdf.setCalendar(cal);
cal.setTime(date);
@anataliocs
anataliocs / twitter.xml
Last active August 29, 2015 13:56 — forked from FranckSilvestre/twitter.xml
Twitter feed module for Google Sites
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="RTS Labs on Twitter" />
<Content type="html">
<![CDATA[
<a class="twitter-timeline" href="https://twitter.com/rtslabs" data-widget-id="433285134742085632">Tweets de @rtslabs</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
]]>
</Content>
</Module>
@anataliocs
anataliocs / oracle-config-jhipster.yaml
Created May 15, 2015 19:11
Oracle config for jHipster Spring Boot App
spring:
profiles: dev
datasource:
driverClassName: oracle.jdbc.OracleDriver
dataSourceClassName: oracle.jdbc.pool.OracleDataSource
url: jdbc:oracle:thin:@localhost:1521:orcl
username: rest_test
password: rest_test
jpa:
@anataliocs
anataliocs / Application.java
Last active September 1, 2022 18:21
Validation messages in messages.properties file for i18n internationalization by locale in spring boot
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@RequestMapping("/")
@ResponseBody
String home() {
@anataliocs
anataliocs / CacheConfig.java
Last active August 4, 2024 04:24
Guava cache with spring boot and clear cache method
import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCache;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheResolver;
import org.springframework.cache.interceptor.KeyGenerator;
@anataliocs
anataliocs / Nonchalantly.java
Last active August 29, 2015 14:27 — forked from poetix/Nonchalantly.java
A Java 8 class to handle checked exceptions
public interface Nonchalantly<T> {
static <T> T invoke(Nonchalantly<T> f) {
try {
return f.run();
} catch (Throwable e) {
throw new RuntimeException( e );
}
}
T run() throws Throwable;