Skip to content

Instantly share code, notes, and snippets.

View srgtuszy's full-sized avatar

Michał Tuszyński srgtuszy

View GitHub Profile
@srgtuszy
srgtuszy / Dockerfile
Created June 17, 2024 10:22
Flutter for web Dockerfile. Use it if you want to deploy your flutter web app is a container
# Stage 1: Build
FROM debian:latest AS build-env
# Install flutter dependencies
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3 sed
RUN apt-get clean
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
@srgtuszy
srgtuszy / peripheraj.js
Created October 26, 2017 14:26
BLE Peripheral
var bleno = require('bleno');
bleno.on('stateChange', function(state) {
console.log('State change: ' + state);
if (state === 'poweredOn') {
console.log('advertising')
bleno.startAdvertising('MyPeripheral',['12ab']);
} else {
bleno.stopAdvertising();
}
@srgtuszy
srgtuszy / answer.json
Last active September 17, 2017 15:44
Rescue.com Answer Phone
[
{
"action" : "talk",
"text": "Emergency announcement #2, Peter is presenting on stage, hope it's not a disaster!"
}
]
@srgtuszy
srgtuszy / gist:6371749
Last active May 18, 2022 03:16
Gradle task for uploading builds to TestFlight using HTTPBuilder
task uploadTf(dependsOn: assembleRelease) << {
def teamToken = '<TestFlight team token here>'
def apiToken = '<TestFlight api token here>'
def lists = '<TestFlight distribution lists here>'
def apk = file("build/apk/$project.name-release.apk")
def notes = new File(file('changelog.mdown')).getText("UTF-8")
def http = new HTTPBuilder('http://testflightapp.com')
println('Uploading build to TestFlight...')
http.request(POST, JSON) { req ->
uri.path = '/api/builds.json'
@srgtuszy
srgtuszy / .emacs
Created June 28, 2013 07:57 — forked from anonymous/.emacs
(add-to-list 'load-path "~/.emacs.d")
(require 'cc-mode)
(require 'autopair)
(autopair-global-mode)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(global-linum-mode t)
(setq-default c-basic-offset 4
tab-width 8
indent-tabs-mode t)
@srgtuszy
srgtuszy / gist:4086991
Created November 16, 2012 12:35
A script for resizing retina images for regular screens
#! /usr/bin/env ruby
require 'RMagick'
def resize_image (image_path, write_path)
image = Magick::Image.read(image_path).first
new_image = image.scale(0.5)
puts "Writing image #{write_path}..."
new_image.write(write_path)
end
@srgtuszy
srgtuszy / UIView+ParentViewController.h
Created January 22, 2012 19:07
Parent UIViewController from UIView
#import <UIKit/UIKit.h>
@interface UIView (Utils)
-(UIViewController *)parentViewController;
@end
+(UIView *)fetchViewFromNib:(NSString *)nibName withClass:(Class)viewClass {
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil];
UIView *view = nil;
for (id object in nibObjects) {
if ([object isKindOfClass:viewClass]) {
view = object;
+(UIView *)fetchViewFromNib:(NSString *)nibName withClass:(Class)viewClass {
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil];
UIView *view = nil;
for (id object in nibObjects) {
if ([object isKindOfClass:viewClass]) {
view = object;
@srgtuszy
srgtuszy / urlcache.m
Created June 26, 2011 21:57
NSURLCache
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];