Skip to content

Instantly share code, notes, and snippets.

@nsarvar
nsarvar / FieldUtils.java
Created July 17, 2021 15:58 — forked from jasper-vandemalle/FieldUtils.java
FieldUtils mutates and accesses fields using reflection.
package be.vandemalle.jasper.util.reflection;
import java.lang.reflect.Field;
import org.apache.commons.lang.StringUtils;
public class FieldUtils {
/**
* Get the specified field on the class. If the field is not found on the class itself will recursively check
* the superclass.
@ryenski
ryenski / hello.vue
Last active April 27, 2023 03:04
Stimulus.js + Vue.js
<template>
<div id="app">
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
data: function () {
return {
@nsarvar
nsarvar / postgres_queries_and_commands.sql
Created May 11, 2018 12:45 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@Tema-man
Tema-man / JsonParser.java
Last active June 17, 2022 13:59
An utility class for parsing json objects using Jackson data binding library
package ru.trendico.biggame.utils;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.io.IOException;
import java.util.ArrayList;
/**
@lelandjansen
lelandjansen / OddOccurrencesInArray.cpp
Last active June 26, 2021 09:10
Returns the value of the unpaired element in an array
int oddOccurrencesInArray(int A[], int N) {
int value = 0;
for (int i = 0; i < N; ++i) value ^= A[i];
return value;
}
// Source: https://codility.com/programmers/task/odd_occurrences_in_array/
// Score: 100%
// That's all folks!
@developius
developius / README.md
Last active April 25, 2024 22:15
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@umidjons
umidjons / web-service-soap-client-server-php.md
Last active May 28, 2023 21:34
Simple Web service - SOAP Server/Client in PHP

Simple Web service - SOAP Server/Client in PHP

Implementation of the SOAP server - server.php:

<?php
// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled","0");

// model, which uses in web service functions as parameter
@jasper-vandemalle
jasper-vandemalle / FieldUtils.java
Created April 25, 2014 06:03
FieldUtils mutates and accesses fields using reflection.
package be.vandemalle.jasper.util.reflection;
import java.lang.reflect.Field;
import org.apache.commons.lang.StringUtils;
public class FieldUtils {
/**
* Get the specified field on the class. If the field is not found on the class itself will recursively check
* the superclass.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'