Skip to content

Instantly share code, notes, and snippets.

View xkrsz's full-sized avatar
🎯
Focusing

Chris Kraszewski xkrsz

🎯
Focusing
View GitHub Profile
@xkrsz
xkrsz / .bash_aliases
Last active November 29, 2015 00:21
Bash aliases
#System
alias s='sudo'
alias get='sudo apt-get install'
alias updaterino='sudo apt-get update'
alias gtfo='sudo apt-get purge'
#Git
alias gs='git status'
alias ga='git add --all'
alias gc='git commit -am'
@xkrsz
xkrsz / beng.rb
Created December 7, 2015 17:14
Generator userów do rails
#!/usr/bin/ruby
puts "Elo, chcesz zrobic [u]czniow czy [a]dministratorow?"
type = gets.chomp
case type
when "u"
puts "Ok, ilu uczniow chcesz zrobic?"
number = gets.chomp.to_i
file = File.open("uczniowie.qtaz", 'w')
@xkrsz
xkrsz / pesel.cpp
Created January 27, 2016 22:37
PESEL
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
#include <string.h>
using namespace std;
int main(){
string pesel;
@xkrsz
xkrsz / promises.js
Created February 16, 2016 00:12
promises
qualified.forEach(function(el) {
kda = (el.stats.totalChampionKills + el.stats.totalAssists) / el.stats.totalDeathsPerSession;
if (kda > bestKda) {
bestKdaChampionId = el.id;
}
});
@xkrsz
xkrsz / getChampion.js
Created February 16, 2016 00:17
Promises
getChampion(bestKdaChampionId, function(data) {
console.log("\n\nYour main: " + data.name + " with " + Number(bestKda.toFixed(2)) + " KDA");
});
@xkrsz
xkrsz / licznik.php
Created February 22, 2016 22:24
Licznik odwiedzin
<?php
session_start();
$plik = "licznik.txt";
if (!file_exists($plik)) {
$f = fopen($plik, "w");
fwrite($f,"0");
fclose($f);
}
@xkrsz
xkrsz / hell.js
Created March 31, 2016 18:21
hell
module.exports = function(agenda, log, reqs, moment) {
agenda.define('update rescue time', function(job, done) {
UserElements.find({rescue_time: {$ne: null}}, function(e, users) {
if(e) log.error(e);
if(users.length > 0) {
users.forEach(function(user) {
reqs.rescueTime(user.rescue_time, function(e, r, b) {
if(b) {
b[0].date = moment(b[0].date);
var date = b[0].date,
$(document).ready ->
nf = $('#n')
snf = $('#sn')
pwf = $('#pw')
cpwf = $('#cpw')
$('#pw').keyup ->
$('#pc').text pwf.val().length
if pwf.val().length < 6
pwf.css 'background-color', 'red'
else
@xkrsz
xkrsz / palindrome.cpp
Created November 8, 2016 21:08
Function checking if string is a palindrome
#include <iostream>
#include <string>
bool isPalindrome(std::string s) {
std::string p = "", f = "";
for(auto c:s) {
c = std::tolower(c);
int i = (int)c;
if(i > 96 && i < 123 || i > 47 && i < 58) {
f += c;

Keybase proof

I hereby claim:

  • I am krszwsk on github.
  • I am krszwsk (https://keybase.io/krszwsk) on keybase.
  • I have a public key ASCA-hRYK6GbKCU61HAbyPHruIYfSJ1W3Xy5oS6aSEUNCQo

To claim this, I am signing this object: