Skip to content

Instantly share code, notes, and snippets.

@leflings
leflings / description.md
Created August 26, 2019 09:25
Product Options API: How to change position of values?

Create the option

POST http://127.0.0.1:8000/api/v1/product-options/ HTTP/1.1
Authorization: Bearer VALID_TOKEN
Content-Type: application/json

{
  "code": "my_test_option_for_testing",
  "position": 10,
@leflings
leflings / description.md
Last active August 23, 2019 10:57
Sylius: /api/v1/product-options/XXX weirdness (question at the end of gist)

Create the option

POST http://127.0.0.1:8000/api/v1/product-options/ HTTP/1.1
Authorization: Bearer VALID_TOKEN
Content-Type: application/json

{
  "code": "my_test_option_for_testing",
  "position": 10,
@leflings
leflings / DynamicSql.fs
Created November 26, 2015 17:04
Slight modification of Tomas Petriceks dynamic sql data reader
open System
open System.Data
open System.Data.SqlClient
open MySql.Data.MySqlClient
type DynamicSqlDataReader(reader:MySqlDataReader) =
member private x.Reader = reader
member x.Read() = reader.Read()
static member (?) (dr:DynamicSqlDataReader, name:string) : 'R =
let typ = typeof<'R>
@leflings
leflings / maxSubarray.java
Created April 1, 2012 12:16
Java: Maximum Subarray
import java.util.*;
public class maxSubarray {
static boolean switchToBrute = false;
static boolean warmup = true;
public static int maxSubarray(int[] A, int lo, int hi) {
int sum, max;
max = A[1];
for (int i = lo; i <= hi; i++) {
@leflings
leflings / gist:1342209
Created November 5, 2011 23:43
brew install cclive failure
==> Downloading http://cclive.googlecode.com/files/cclive-0.6.5.tar.bz2
/usr/bin/curl -f#LA Homebrew 0.8 (Ruby 1.8.7-249; Mac OS X 10.7.2) http://cclive.googlecode.com/files/cclive-0.6.5.tar.bz2 -o /Users/leflings/Library/Caches/Homebrew/cclive-0.6.5.tar.bz2
0.0%
0.9%
# 1.8%
# 2.7%
## 3.6%
### 4.5%
class Movie < ActiveRecord::Base
attr_accessible :name, :year, :rating, :watched, :imdb_id
has_many :relationships
has_many :people, :through => :relationships
has_many :roles, :through => :relationships
scope :is_acting, lambda { acting }
scope :is_directing, lambda { directing }