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
# copied from https://stackoverflow.com/questions/2024805/ruby-send-json-request | |
require 'net/http' #net/https does not have to be required anymore | |
require 'json' | |
require 'uri' | |
uri = URI('https://your.secure-url.com') | |
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| | |
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') | |
request.body = {parameter: 'value'}.to_json |
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
obs := list("normal", "cold", "dizzy") | |
states := list("Healthy", "Fever") | |
start_p := Map with( | |
"Healthy", 0.6, | |
"Fever", 0.4 | |
) | |
trans_p := Map with( | |
"Healthy", Map with( | |
"Healthy", 0.7, | |
"Fever", 0.3 |
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
obs = {'normal', 'cold', 'dizzy'} | |
states = {'Healthy', 'Fever'} | |
start_p = { | |
Healthy: 0.6, | |
Fever: 0.4 | |
} | |
trans_p = { | |
Healthy: { | |
Healthy: 0.7, |
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
const obs = ["normal", "cold", "dizzy"] | |
const states = ["Healthy", "Fever"] | |
const start_p = { | |
Healthy: 0.6, | |
Fever: 0.4, | |
} | |
const trans_p = { | |
Healthy: { | |
Healthy: 0.7, |
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
class Main { | |
public static function main() { | |
trace(dichotomySqrt(2)); | |
trace(newtonSqrt(2)); | |
} | |
static function dichotomySqrt(x:Float):Float { | |
if (x < 0) { | |
return Math.NaN; | |
} |
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
#!/bin/bash | |
# Script to disable the iOS Simulator app from showing the "Do you want the application xxxx to accept incoming network connections?" pop-up every time the app is run | |
echo "> Enter password to temporarily shut firewall off" | |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off | |
echo "> Add Xcode as a firewall exception" | |
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode |
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
#!/usr/bin/env io | |
Yajl | |
Regex | |
Message do( | |
asMap := method( | |
if( | |
self name allMatchesOfRegex("(^[0-9\"])|true|false|nil") isNotEmpty, |
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
#!/usr/bin/env io | |
CFunction := Object clone do( | |
returnType ::= nil | |
name ::= nil | |
paramTypes ::= nil | |
curlyBrackets := method( | |
msg_list := list() | |
msg := call argAt(0) |
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
#!/usr/bin/env io | |
StructDefinition := Object clone do( | |
name ::= "" | |
memberList ::= list() | |
with := method(name, | |
self clone setName(name) setMemberList(list()) | |
) |
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
-(void) composeVideoClips:(NSMutableArray<AVURLAsset *> *)videoClips | |
forComposition:(AVMutableComposition *)composition | |
mediaType:(NSString *)mediaType | |
{ | |
AVMutableCompositionTrack * composedTrack = | |
[composition addMutableTrackWithMediaType:mediaType | |
preferredTrackID:kCMPersistentTrackID_Invalid]; | |
CMTime time = kCMTimeZero; | |
for (AVURLAsset *videoClip in videoClips) { |
NewerOlder