Skip to content

Instantly share code, notes, and snippets.

View Rudis1261's full-sized avatar

Rudi Strydom Rudis1261

View GitHub Profile
@Override
public boolean onTouchEvent(MotionEvent event)
{
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
x1 = event.getX();
y1 = event.getY();
break;
@Rudis1261
Rudis1261 / remove.js
Created May 11, 2017 09:42
Remove Page's CSS
var styles = document.querySelectorAll('style');
for(var i = 0; i < styles.length; i++) {
styles[i].remove();
}
var linkedStyles = document.querySelectorAll('link[rel="stylesheet"]');
for(var i = 0; i < linkedStyles.length; i++) {
linkedStyles[i].remove();
}
@Rudis1261
Rudis1261 / upload.component.ts
Created March 5, 2017 18:57 — forked from StephenFluin/upload.component.ts
Firebase Uploader Component with Angular 2
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import { Observable } from 'rxjs';
declare var firebase: any;
interface Image {
path: string;
@Rudis1261
Rudis1261 / sublime_word_selecting.json
Created December 13, 2016 07:02
Just how sublime determines how to separate words
{
"word_separators": "./\\()\"':,.;<>~!@#%^&*|+=[]{}`~?"
}
@Rudis1261
Rudis1261 / Dockerfile
Last active November 8, 2018 22:36
Rails Docker Setup
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN apt-get install -y imagemagick
RUN mkdir /usr/local/rails-app
WORKDIR /usr/local/rails-app
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
@Rudis1261
Rudis1261 / Recursive_Directory_Array.php
Created December 2, 2016 22:10
Creating a recursive directory array
/**
* Sets a value in a nested array based on path
* See http://stackoverflow.com/a/9628276/419887
*
* @param array $array The array to modify
* @param string $path The path in the array
* @param mixed $value The value to set
* @param string $delimiter The separator for the path
* @return The previous value
*/
@Rudis1261
Rudis1261 / flexbox.scss
Created November 10, 2016 05:57
A SCSS Flexbox Mixin, including IE10 logic
@mixin flex-direction($direction: row) {
-webkit-flex-direction: $direction;
-ms-flex-direction: $direction;
flex-direction: $direction;
}
@mixin flex-wrap($wrap: nowrap) {
@if $wrap == nowrap {
-ms-flex-wrap: none;
}
@Rudis1261
Rudis1261 / deploy.sh
Created November 3, 2016 13:06
Just another deploy script
#!/bin/bash
git pull -s recursive -X theirs origin $1
RAILS_ENV=mnet_production bundle exec rake assets:precompile
service unicornswipe1 restart
@Rudis1261
Rudis1261 / firewall.sh
Created November 3, 2016 06:15
Firewall Setup Script
#!/bin/bash
source hostlist.sh
hostname=`hostname`
private_range=$(printf ",%s" "${ips[@]}")
private_range=${private_range:1}
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
@Rudis1261
Rudis1261 / login.sh
Created August 29, 2016 06:21
SSH Login Script - The Dirty Way
#!/usr/bin/expect -f
# REPLACE, <user>, <host> and <password>
spawn ssh <user>@<host>
expect "assword:"
send "<password>\r"
interact