Skip to content

Instantly share code, notes, and snippets.

@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@Kostanos
Kostanos / json-to-csv.php
Created May 24, 2013 03:28
Convert JSON array file to CSV. Use the array keys as the first row. Command line using: json-to-csv.php json.filename > csv.filename
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example:
@st0le
st0le / TwoSum.java
Created June 30, 2013 00:00
Linear Algorithm for 2SUM on a sorted array.
// If Array was already sorted
// Complexity - O(n)
private int[] findPair_4(int[] A) {
int left = 0, right = A.length - 1;
while (left < right) {
int s = A[left] + A[right];
if (s == 0)
return new int[]{A[left], A[right]};
else if (s > 0)
right--;
@maksimr
maksimr / evaluate-model.lisp
Created March 21, 2014 14:09
Аппликативный и нормальный порядки вычисления
; Аппликативный и нормальный порядки вычисления
;
; «полная подстановка, затем редукция» известен под на-
; званием нормальный порядок вычислений (normal-order evaluation)
;
; Пример работы нормального порядка вычисления
; Последовательность подстановок
; (sum-of-squares (+ 5 1) (* 5 2))
; (+ (square (+ 5 1)) (square (* 5 2))
; (+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active November 14, 2024 09:13
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@touhonoob
touhonoob / gs.nginx.conf
Created June 6, 2015 13:35
Nginx as Google Cloud Storage Cache
# Cache 10GB for 1 Month
proxy_cache_path /var/cache/nginx keys_zone=GS:10m inactive=720h max_size=10240m;
upstream gs {
server 'storage.googleapis.com:80';
keepalive 100;
}
server {
set $my_domain "yourdomain.com";
@marszall87
marszall87 / docker-compose-install.sh
Created September 25, 2015 13:14
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@sourcec0de
sourcec0de / docker-compose-coreos.sh
Created November 30, 2015 19:39
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@miguelsaddress
miguelsaddress / octave.md
Created January 6, 2016 20:25 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &amp;&amp;