Skip to content

Instantly share code, notes, and snippets.

View capJavert's full-sized avatar
🤘
Kicking ass!

Ante Barić capJavert

🤘
Kicking ass!
View GitHub Profile
public class TermHelper {
public static final String ESC = "\033[";
public static void clearScreen() {
System.out.print(ESC + "2J");
}
public static void moveTo(int x, int y) {
System.out.print(ESC + y + ";" + x + "H");
}
String adminRegex = "^(-admin)? ?-server (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)) -port ([8|9][0-9]{3}) -u ([a-zA-Z0-9-_]+) -p ([a-zA-Z0-9-_!#]+) -(pause|stop|start|stat)$";
String userRegex = "^(-korisnik)? ?-s (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)) -port ([8|9][0-9]{3}) -u ([a-zA-Z0-9-_]+) ?(-(a|t) (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)))? ?(-w ([0-6][0-9]{2}))?$";
String showRegex = "^(-prikaz)? ?-s ((:?([a-zA-Z]:|(http:(?:\\\\|\\/))))?(?:(?:\\\\|\\/)?(\\w[\\w ]*.*))+\\.(?:(?i)bin(?-i)))$";
@valfer
valfer / sendPush.txt
Last active April 29, 2024 12:29
Sending Push Notification with HTTP2 (and PHP) see entire post at: http://coding.tabasoft.it/ios/sending-push-notification-with-http2-and-php/
<?php
/**
* @param $http2ch the curl connection
* @param $http2_server the Apple server url
* @param $apple_cert the path to the certificate
* @param $app_bundle_id the app bundle id
* @param $message the payload to send (JSON)
* @param $token the token of the device
* @return mixed the status code (see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW18)
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@ppamorim
ppamorim / ImageInsets.swift
Created November 5, 2015 16:30
Add padding/margin at a image!
import UIKit
extension UIImage {
func imageWithInsets(insetDimen: CGFloat) -> UIImage {
return imageWithInset(UIEdgeInsets(top: insetDimen, left: insetDimen, bottom: insetDimen, right: insetDimen))
}
func imageWithInset(insets: UIEdgeInsets) -> UIImage {
UIGraphicsBeginImageContextWithOptions(
CGSizeMake(self.size.width + insets.left + insets.right,
@gokulkrishh
gokulkrishh / media-query.css
Last active May 8, 2024 06:59
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
import Foundation
import UIKit
public enum UIButtonBorderSide {
case Top, Bottom, Left, Right
}
extension UIButton {
public func addBorder(side: UIButtonBorderSide, color: UIColor, width: CGFloat) {
@roachhd
roachhd / README.md
Last active May 7, 2024 09:08
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" &gt; index.html