This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.button.radio; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.view.View.OnClickListener; | |
import android.widget.Button; | |
import android.widget.RadioButton; | |
import android.widget.RadioGroup; | |
import android.widget.Toast; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'json' | |
SITE = "http://www.righttofoodindia.org/" | |
links = JSON.parse(File.open("map.json").read) | |
# links.each do |link| | |
# filename = link["name"].downcase.gsub(" ", "_").gsub("'", "").gsub("/", "") | |
# category = link["uri"].split("/").first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM fedora:22 | |
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8" | |
RUN dnf groupinstall -y "Development Tools" "Development Libraries" && dnf install -y wget git tar bzip2 && dnf clean all | |
RUN \ | |
wget http://www.erlang.org/download/otp_src_18.1.tar.gz && \ | |
tar -zxf otp_src_18.1.tar.gz && \ | |
cd otp_src_18.1 && \ | |
export ERL_TOP=`pwd` && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PuzzledPintScriptElixir do | |
@base_string "http://www.puzzledpint.com/puzzles/august-2015/semaphore/" | |
defp get_file_strings do | |
File.read! "/usr/share/dict/cracklib-small" | |
end | |
def list_of_urls do | |
get_file_strings | |
|> String.split("\n", trim: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void holdYaw(double target,double factor) throws FgException | |
{ | |
// get current Heading degree | |
// calculate the deviation in degree | |
double aircraftHdg = a.getHeadingDeg(); | |
double degreeToTurn = calcDegreeToTurn(); | |
// Limit the potential for an integrator to accumulate ridicuously high values when | |
// we cannot reach its target yaw for a period of time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://en.wikipedia.org/wiki/Simple_linear_regression | |
defmodule Exchange.Calc do | |
def linear_regression(points) do | |
n = length(points) | |
# Average of sum of products | |
sop_bar = sum_of_products(points) / n | |
# Average of sum of x and y respectively |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://en.wikipedia.org/wiki/Simple_linear_regression | |
# Exchange.Calc.Regression.run(self, [{1,1},{2,2},{3,3}]) | |
defmodule Exchange.Calc.Regression do | |
def run(recipient, points) do | |
n = length(points) | |
fn_builder = spawn(Exchange.Calc.Regression, :build_function, [recipient, []]) | |
spawn(Exchange.Calc.Regression, :sum_products_avg, [fn_builder, points, n]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Generator do | |
# Generates a method like the following | |
# def to_word(n) when n >= 1_000 do | |
# [to_word(div(n, 1_000)), "thousand,", to_word(rem n, 1_000)] | |
# end | |
defmacro gen_method(input) do | |
quote bind_quoted: [input: input] do | |
def to_word(n) when n >= unquote(input[:num]) do | |
[to_word(div(n, unquote(input[:num]))), "#{unquote(input[:text])},", to_word(rem n, unquote(input[:num]))] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation do | |
field :submit_comment, :comment do | |
arg :repo_fullname, non_null(:string) | |
arg :content, non_null(:string) | |
resolve fn args, _ -> | |
comment = # create comment | |
{:ok, comment} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Comment on a repository, returns the new comment | |
submitComment( | |
# The full repository name from GitHub, e.g. "apollostack/GitHunt-API" | |
repoFullName: String!, | |
# The text content for the new comment | |
commentContent: String! | |
): Comment | |
type Subscription { | |
# Subscription fires on every comment added |