Skip to content

Instantly share code, notes, and snippets.

Weixi Yen weixiyen

Block or report user

Report or block weixiyen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View update.ex
User
|> prepared(user_id: user_id, username: username)
|> insert(user_id: :user_id, username: :username)
|> if_not_exists
|> User.save
User
|> update(username: username)
|> where(user_id: user_id)
|> constrain(username: previous_username)
View query.ex
User
|> prepared(user_id: id)
|> select([:user_id, :username])
|> where(user_id: :user_id)
|> User.one
User
|> select([:user_id, :username])
|> where(user_id: [in: [1, 2, 3]])
|> limit(10)
View mv.ex
defmodule Schema.UserByEmail do
require Schema.User # if you want to auto-create at compile time
use Triton.MaterializedView
materialized_view :users_by_email, from: Schema.User do
fields [
:user_id,
:email,
:display_name,
:password
View table.ex
defmodule Schema.User do
require Schema.Keyspace
use Triton.Table
table :users, keyspace: Schema.Keyspace do
field :user_id, :bigint, validators: [presence: true] # validators using vex
field :username, :text
field :display_name, :text
field :password, :text
field :email, :text
View gist:7dff79d1329c514628d7
//
// FFVerifyLocationViewModel.m
// Blitz
//
// Created by Sunny Kang on 9/1/14.
// Copyright (c) 2014 Blitz. All rights reserved.
//
#import "FFVerifyLocationViewModel.h"
#import <CoreLocation/CoreLocation.h>
View gist:9197399

Week 3 Summary

Lunar Revel Battle of 2-0 Teams

  • storm8 (3-0) def factset (2-1)
  • nerdery (3-0) def google sapphire (2-1)
  • amazon prime (3-0) def microsoft spaceland (2-1)
  • curse tibbers (3-0) def raytheon (2-1)
@weixiyen
weixiyen / gist:1250090
Created Sep 29, 2011
Push server with Redis Subscriber
View gist:1250090
require.paths.unshift(process.cwd() + '/lib')
require.paths.unshift(process.cwd() + '/contrib')
redis = require 'redis'
settings = require('settings').stream
# DEFAULT SETTINGS
# -------------------------------------------------
settings.port = process.argv[2] if process.argv[2]?
io = require('socket.io').listen Number(settings.port)
View gist:1250084
###
Async.js is a collection of simple async patterns
built to combat callback hell
###
###
ASYNC SEQUENCE
Allows a user to define a sequence of async functions.
EXAMPLE:
async = require 'async'
View jquery-filedrop.js
(function($){
var opts = {},
default_opts = {
url: '',
refresh: 1000,
paramname: 'userfile',
maxfiles: 25,
maxfilesize: 1, // MBs
data: {},
You can’t perform that action at this time.