Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Rampersad ryanmr

View GitHub Profile
View weather.php
<?php
$url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20woeid%3D12781740&format=json&diagnostics=true&callback=";
// $url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22Macalester%20-%20Groveland%2C%20MN%22&format=json&diagnostics=true&callback=";
// $url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20woeid%3D29306623&format=json&diagnostics=true&callback=";
$text = file_get_contents($url);
$data = json_decode($text, true);
function get_location($data) {
View grid.c
/*
Use ifupdown.com/putnam/generator.html
to generate a matrix and global values.
Then paste that generated code here.
*/
void loop() {
View ContactsListAdapter.java
package com.ifupdown.odin.adapters;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
View record.bash
#!/bin/bash
# don't forget to include ADB in your path
# for example, in your ~/.bashrc, somewhere near the top
# export PATH=$PATH:/path/to/android-sdk/sdk/platform-tools
# check if there is a filename
if [ -z "$1" ]; then
echo usage: $0 filename
exit
View example.rs
use std::io;
use std::rand;
struct Monte {
h: uint,
k: uint,
r: uint
}
fn main() {
View simul.rs
fn multi() {
let tasks:uint = 4;
let (tx, rx): (Sender<uint>, Receiver<uint>) = channel();
let mut senders = Vec::<Sender<uint>>::new();
let mut receivers = Vec::<Receiver<uint>>::new();
for i in range(0, tasks) {
View wargame.rs
extern crate time;
use std::fmt;
use time::precise_time_ns;
use std::rand::{task_rng, Rng};
#[deriving(Clone)]
enum Value {
Two,
View match2.rs
let args = os::args();
let tasks:uint = match args.len() {
2 => match args[1].as_slice().trim().parse() {
Some(x) => x,
None => 1
},
_ => 1
};
View gist:2a2b60f059d3dc8305f5
ryans-mba:rust-wg ryanrampersad$ cargo run --bin game
Compiling wargame v0.0.1 (file:///Users/ryanrampersad/Desktop/rust-wg)
/Users/ryanrampersad/Desktop/rust-wg/src/wg.rs:2:1: 2:23 error: compile time crate loading is experimental and possibly buggy
/Users/ryanrampersad/Desktop/rust-wg/src/wg.rs:2 #[phase(plugin, link)] extern crate log;
^~~~~~~~~~~~~~~~~~~~~~
/Users/ryanrampersad/Desktop/rust-wg/src/wg.rs:2:1: 2:23 help: add #![feature(phase)] to the crate attributes to enable
/Users/ryanrampersad/Desktop/rust-wg/src/wg.rs:2 #[phase(plugin, link)] extern crate log;
^~~~~~~~~~~~~~~~~~~~~~
View callgrind.log
--------------------------------------------------------------------------------
Profile data file 'callgrind.out.23136' (creator: callgrind-3.8.1)
--------------------------------------------------------------------------------
I1 cache:
D1 cache:
LL cache:
Timerange: Basic block 0 - 273612
Trigger: Program termination
Profiled target: ./game (PID 23136, part 1)
Events recorded: Ir
You can’t perform that action at this time.