Skip to content

Instantly share code, notes, and snippets.

SELECT customer_name, cust_date
FROM customer
JOIN cust ON customer.customer = cust.customer_id
WHERE EXTRACT(MONTH FROM cust_date) = EXTRACT(MONTH FROM DATEADD(-1 MONTH TO CURRENT_DATE))
@jgc128
jgc128 / gist:5430749
Created April 21, 2013 19:29
SQL generated by LINQ
{SELECT
[Project6].[id] AS [id],
[Project6].[C1] AS [C1],
[Project6].[stimul] AS [stimul],
[Project6].[C3] AS [C2],
[Project6].[C2] AS [C3],
[Project6].[reaction] AS [reaction],
[Project6].[C4] AS [C4]
FROM ( SELECT
[Project1].[id] AS [id],
CREATE TABLE dae.dbo.stimuls(
id INT IDENTITY,
stimul NVARCHAR(100) NOT NULL,
CONSTRAINT PK_stimuls PRIMARY KEY (id)
)
GO
SELECT
[Project2].[id] AS [id],
[Project2].[stimul] AS [stimul]
FROM ( SELECT
[Extent1].[id] AS [id],
[Extent1].[stimul] AS [stimul]
FROM [dbo].[stimuls] AS [Extent1]
WHERE EXISTS (SELECT
1 AS [C1]
FROM [dbo].[reactions] AS [Extent2]
@jgc128
jgc128 / Client.cs
Created June 23, 2013 18:49
WinRT client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Networking;
using Windows.Networking.Sockets;
using Windows.Storage.Streams;
namespace AzalyDC.Common.Networking
@jgc128
jgc128 / gist:6468347
Created September 6, 2013 18:57
Mobile services | Top
function insert(item, user, request) {
var topTable = tables.getTable('Leaderboard');
var minItem = topTable.orderBy('Score').take(1).read({
success: function(results) {
if(item.Score > minItem.Score)
{
request.execute();
var ret = JObject.Parse(@"{
'response': [{
id: 205387401,
first_name: 'Tom',
last_name: 'Cruise',
sex: 2,
city: '5331',
country: '9'
}]}");
Mock<IApi> mock = new Mock<IApi>();
@jgc128
jgc128 / var1
Created December 17, 2013 11:02
Nutcracker Android code
if(client != null) {
try {
client.onConnected = new OnConnected() {
public void run(final OrtcClient sender) {
Log.i(LOG_TAG, "connected to " + sender.getUrl());
client.subscribe(notificationChannel, true, new OnMessage() {
public void run(OrtcClient sender, String channel, String message) {
{
"response":{
"game":[
{
"game_id":1,
"interaction":{
"max":100.0,
"type":"VoteGame",
"id":1,
"min":0.0
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>