Skip to content

Instantly share code, notes, and snippets.

# Parse input
n = gets.strip.to_i
a = Array.new(n)
(0...n).each { |a_i|
a_t = gets.strip
a[a_i] = a_t.split(' ').map(&:to_i)
arr = a[a_i]
}
# Initialize variables
Hey guys!
I am a little stuck on Title Case checkpoint on Ruby Arrays.
“We will need to use conditional logic --if and else statements -- to make this work. Read the test specification carefully so you understand the conditional logic to be implemented.
Some helpful methods to use are:
String#downcase
String#capitalize
b=$(basename "$1")
echo -n "http://example.com/uploads/$b" | pbcopy
for i
do
b=$(basename "$1")
mv "$i" "/path/to/Uploads/$b"
done
import os
from threading import Thread
from time import sleep
import asyncio
FIFO_PATH = "/path/to/crash-log"
class FifoReader(Thread):
def __init__(self, path, crash):
super().__init__()
@flagoworld
flagoworld / pack.m
Last active August 29, 2015 14:27
packing some data
- (NSData *)build
{
uint32_t type = _type; // 0
uint32_t command = _command; // 3
NSString *data = _data; // @""
unsigned char byte = 0x00; // 0
unsigned long size = sizeof(command) + sizeof(type) + data.length + sizeof(byte); // 9
unsigned long totalSize = sizeof(uint32_t) + size; // 10 (including size uint32)
unsigned char bytes[totalSize];
@flagoworld
flagoworld / gstore.rs
Created July 21, 2015 04:33
gstore multi type hashmap
use std::any::Any;
use std::collections::HashMap;
use std::fmt;
pub struct GStore
{
map: HashMap<String, Box<Any>>
}
impl GStore
@flagoworld
flagoworld / lin-master.js
Last active August 29, 2015 14:22
first stages of a nodejs LIN master
var async = require('async');
var _ = require('lodash');
var SerialPort = require('serialport');
// SerialPort.list(function (err, ports) {
// ports.forEach(function(port) {
// console.log(port.comName);
// console.log(port.pnpId);
// console.log(port.manufacturer);
// });
@flagoworld
flagoworld / RangeStreamer.h
Last active May 1, 2019 02:48
AVAssetResourceLoaderDelegate - Stream from server that requires specific auth headers
//
// RangeStreamer.h
// iOS Player
//
// Created by Ryan Layne on 4/2/15.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@flagoworld
flagoworld / lol.m
Last active August 29, 2015 14:15
lol
NSDictionary *cases = @{
@"name": ^{
return field.name;
},
@"type": ^{
return field.typeString.lowercaseString;
}
}
void (^block)() = cases[ident];
@flagoworld
flagoworld / gist:a1aab80580966a42e7f6
Created November 24, 2014 02:28
BMW2002 checklist
BMW 2002 Checks
Rust
shock towers
floor pans / The driver and passenger floors
spare tire well in the trunk
The lower rocker panels on each side of the car
The gas tank area
mainly look in those spots as those the hard places to fix it