Skip to content

Instantly share code, notes, and snippets.

@mamaz
mamaz / resize_parallel.go
Last active November 11, 2018 13:41
Resize Image in Parallel
package resizeparallel
import (
"Exercise/ResizeImage/lib/resizer"
"Exercise/ResizeImage/lib/types"
"flag"
"fmt"
"os"
"runtime"
"time"
@mamaz
mamaz / print_task.go
Created November 9, 2018 16:15
Simple print task
package printTask
import (
"fmt"
"sync"
)
// PrintM - Just print M a hundre times
func PrintM(waitgroup *sync.WaitGroup) {
defer waitgroup.Done()
@mamaz
mamaz / simple_main.go
Created November 9, 2018 15:47
Main File for Showing Concurrent vs Parallel
package main
import (
c "Exercise/ConcurrencyAndParallel/concurrency"
p "Exercise/ConcurrencyAndParallel/parallel"
"fmt"
)
// This is a demo for showing concurrency and parallelism works in Golang.
// the RunConcurrently() shows how to print a series of numbers and alphabet using single physical processors,
@mamaz
mamaz / concurrent.go
Last active November 11, 2018 10:30
Run in Concurrent Manner
package concurrency
import (
"Exercise/ConcurrencyAndParallel/printTask"
"fmt"
"runtime"
"sync"
"time"
)
@mamaz
mamaz / parallel.go
Last active November 11, 2018 10:29
Run Parallel
package parallel
import (
"Exercise/ConcurrencyAndParallel/printTask"
"fmt"
"runtime"
"sync"
"time"
)
@mamaz
mamaz / LoadMore.m
Created May 2, 2016 05:33
Load more WhatsApp like
[self.TableView reloadData];
[self.TableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:someRow inSection:someSection] atScrollPosition:UITableViewScrollPositionTop animated:NO];
@mamaz
mamaz / regex.txt
Created March 2, 2016 06:53
Regex for URL
/^http:\/\/|(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/
@mamaz
mamaz / mocha.js
Created December 29, 2015 10:00
Just a mocha template
var assert = require('assert');
var async = require('asyncawait/async');
var await = require('asyncawait/await');
describe('hooks', function() {
before(function() {
// runs before all tests in this block
});
@mamaz
mamaz / cell.m
Created September 8, 2015 09:47
Make sure one cell has only one button tap subscriber
// make sure one cell has one subscriber
[[thumbnailCell.checkMarkSignals
takeUntil:cell.rac_prepareForReuseSignal]
subscribeNext:^(id x) {}];
@mamaz
mamaz / Animate.m
Last active June 30, 2016 13:32
Animate using Autolayout the correct way
// source:
// http://stackoverflow.com/a/12664093/1328982
// credits to: Gervasio Marchand
- (void)moveBannerOffScreen {
[self.view layoutIfNeeded];
[self.childView mas_remakeConstraints:(MASConstraint* make){
make.top.mas_equal(0);
make.left.mas_equal(0);