Skip to content

Instantly share code, notes, and snippets.

@appleios
appleios / yandex_arm_2_proc.c
Created February 25, 2015 11:22
yandex_arm_2_proc
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#define BATCH_SIZE 10
void calc_stat_for(char *batch, int sz, int *stat){
int i;
print_batch(batch,sz);

Please visit new wiki for more info and tasks!

Ruby 1

  • ruby style => OOP everywhere, e.g. 2 + 2 is a call Fixnum(2).+(Fixnum(2))
  • [1,2,3].each {|n| puts n}
  • Simple classes (Fixnum, String, Float)
  • Kernel (puts, gets, p)

Ok, so Inheritance

its not just for young white dudes waiting for their grandparents to fucking keel over at 82.

In ruby, Inheritance allows one class to inherit from another class attributes and behaviors (methods) that it didnt have before. The inheriter, much like a young white male, is the child class. The class that it inherits from, rather than being his old money grandparents, is the Parent Class. The lesson says Inheritance is designated with a < symbol, for example:

class Daughter < Father
end
@appleios
appleios / _test.rb
Last active August 29, 2015 14:20 — forked from jcoglan/_test.rb
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@appleios
appleios / family_tv.cpp
Created June 14, 2015 08:17
task about family tv
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
int a,d,m,o,c,f,x;
printf("A D M O C | F\n");
for(x=0; x<32; x++){
a = x & 16;
@appleios
appleios / update_string.rb
Last active September 17, 2015 13:48
update_string for xcode
#!/usr/bin/ruby
require 'date'
require 'pp'
COMPANY_NAME="<#company_name#>"
if ARGV.count != 1
puts "Usage: update_strings.rb /path/to/source/dir"
puts "Path and project_name are case sensitive."
@appleios
appleios / keyboard.m
Last active August 29, 2015 14:25
keyboard notification observers (ios)
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
@appleios
appleios / VIOSXibLoader.h
Created September 21, 2015 10:15
XibLoader
//
// VIOSXibLoader.h
// Created by Aziz Latypov on 8/21/15.
//
// If your TableViewCells are in Xib files and you name them in some convencion
// described with regular expression, you can load them into a table like this:
// In your viewDidLoad method call
// [[VIOSXibLoader defaultLoader] loadXibsForTableView:self.tableView
// withPattern:@"^MyModelClassName(\\w*)TableViewCell$"];
//
@appleios
appleios / codestyle.md
Last active September 29, 2015 13:37
my objc codestyle
@appleios
appleios / Objective-C property name to a string with autocompletion and compile-time check.md
Created October 27, 2015 14:28 — forked from xareelee/NSObject+PropertyName.h
Objective-C property name to a string with autocompletion and compile-time check

Getting a string value for a property of a class with autocompletion feature and checking it at compile-time is very useful.

How to use:

Get the property name for a class:

@interface AnyClass : NSObject
@property (strong) NSData *data;