Skip to content

Instantly share code, notes, and snippets.

View jvelo's full-sized avatar
🦉
transient

Jerome Velociter jvelo

🦉
transient
View GitHub Profile
@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@kimble
kimble / DropwizardTestServer.java
Created May 25, 2012 19:15
JUnit @rule for running Dropwizard integration test. Ps! This is just a proof of concept. There are probably some landminds lying around waiting to go off, especially around lifecycle management and static state
package com.developerb.dropwizard;
import com.yammer.dropwizard.AbstractService;
import com.yammer.dropwizard.Service;
import com.yammer.dropwizard.cli.Command;
import com.yammer.dropwizard.config.Configuration;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 19:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kevinswiber
kevinswiber / hal.json
Created July 7, 2012 14:56
JSON Siren vs. HAL Representations
{
"_links": {
"self": { "href": "/orders" },
"next": { "href": "/orders?page=2" },
"find": { "href": "/orders{?id}", "templated": true }
},
"_embedded": {
"orders": [{
"_links": {
"self": { "href": "/orders/123" },
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@meirish
meirish / index.html
Last active March 6, 2017 18:40
First attempt trying to detect amount of free space in WebSQL using a temporary db that we fill with 0's. Blog post to follow.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Yardstick Test</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<script src="./yardstick.js"></script>
<style type="text/css" media="all">
@karmi
karmi / .gitignore
Last active August 24, 2020 09:25
Elasticat makes Elasticsearch JSON responses pretty • http://git.io/elasticat
.DS_Store
tmp/
@ryankennedy
ryankennedy / asmifier.c
Last active January 4, 2017 13:27
Quickly creating a command line utility to run ASMifier (http://asm.ow2.org/asm40/javadoc/user/org/objectweb/asm/util/ASMifier.html).
#include <stdio.h>
#include <errno.h>
int main(int argc, char* argv[]) {
int i;
char* argv2[argc+3];
argv2[0] = "java";
argv2[1] = "-cp";
argv2[2] = argv[0];
argv2[3] = "org.objectweb.asm.util.ASMifier";
@Dierk
Dierk / ModularGroovyTraits
Created April 6, 2014 19:23
Using modular traits in Groovy 2.3.0-beta-1
trait HasId {
long id
}
trait HasVersion {
long version
}
trait Persistent {
boolean save() { println "saving ${this.dump()}" }
}
trait Entity implements Persistent, HasId, HasVersion {
@pozs
pozs / json_object_agg.sql
Last active May 18, 2020 10:58
Multiple functions to modify json objects in PostgreSQL
-- Aggregate function to aggregate key-value pairs to json object (opposite of json_each())
-- requires PostgreSQL 9.3+ (but < 9.4!)
-- requires function "json_object_set_key"
DROP AGGREGATE IF EXISTS "json_object_agg" (TEXT, anyelement);
CREATE AGGREGATE "json_object_agg" (TEXT, anyelement)
(
STYPE = json,
SFUNC = "json_object_set_key",