Skip to content

Instantly share code, notes, and snippets.

View Kr3m's full-sized avatar

Kevin Remisoski Kr3m

View GitHub Profile
@Kr3m
Kr3m / 0_reuse_code.js
Created April 9, 2014 12:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Kr3m
Kr3m / CodeIgniter Setup Script
Created April 10, 2015 21:24
PowerShell script created to make easy CodeIgniter setups
# CodeIgniter Setup Script by Kevin Remisoski - (old could use some work as noted below)
# Work to be done:
# 1. Merge hosts.pl
# 2. Create menu with support for various frameworks and multi-level for various versions
# 3. Support for grunt, bower, npm, etc..
# Dependencies - git > http://git-scm.com/ && hosts.pl > https://gist.github.com/markembling/173887
# This is just a powershell script I created. I just learned powershell a little bit in the last 15 minutes, and thought I'd modify an existing batch file I created to take care of some more advanced features I wanted.
@Kr3m
Kr3m / hosts.ps1
Created October 26, 2013 04:22 — forked from markembling/hosts.ps1
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
@Kr3m
Kr3m / conc.js
Last active April 15, 2016 05:56
/**
* conc() Console Comments w/ print_r support by Faisalman
*
* @author Kevin Remisoski <kevin@remytek.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link https://gist.github.com/Kr3m/cfeb326cd63db2befa83a629dbc1b24a
* usage: conc(msg, output) e.g. conc('Hello World!', var);
* to do: remove redundancies (e.g. isArr)
*/
var conc = function(msg = null, output = null) {
@Kr3m
Kr3m / sublime_text_2_useful_shortcuts.md
Created July 2, 2016 06:26 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@Kr3m
Kr3m / fixsound.sh
Created April 3, 2019 13:29
Ubuntu Fix Sound
#!/bin/bash
# I'm hoping this helps you as much as it helped me.
# If you're without sound and maybe just upgraded Ubuntu...
# Try this out and then try your sound settings again.
pulseaudio -k && sudo alsa force-reload
@Kr3m
Kr3m / README.md
Created May 14, 2019 19:16
HTML to PDF conversion in PHP using wkhtmltopdf (and optionally Smarty)

Recently I was asked to generate PDF invoices for an online shop. I looked at various PHP PDF generators, but wasn't particularly impressed with any of them.

Then I found (via Stack Overflow) a command-line HTML-to-PDF convertor called wkhtmltopdf, which uses WebKit (the same layout engine as Safari and Google Chrome) and therefore is very accurate.

There is a class for PHP integration on the Wiki, but I found it overly complicated and it uses temp files which aren't necessary. This is the code I wrote instead.

I used Smarty for generating the HTML for the PDF, but you can use any template engine, or pure PHP if you prefer.

Note: I originally tried to install wkhtmltopdf from source, but it's much easier to use the static binary instead.

@Kr3m
Kr3m / class.envato-api-basic.php
Created May 14, 2019 23:19 — forked from dtbaker/class.envato-api-basic.php
Simple PHP class for interacting with the Envato API within a WordPress plugin
<?php
/**
* Exception handling class.
*/
class EnvatoException extends Exception {
}
@Kr3m
Kr3m / rssToJson
Created June 25, 2019 01:27 — forked from BilalBudhani/rssToJson
PHP function to convert simple RSS to JSON
public function Parse ($url) {
$fileContents= file_get_contents($url);
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents);
$json = json_encode($simpleXml);
return $json;
}
@Kr3m
Kr3m / TestDialogue.cs
Created July 5, 2019 01:09
Testing Dialogue from XML
private static void TestDialogue()
{
var dialogue = GameDialogue.DialogueList;
for (var i = 0; i < dialogue.Count; i++)
{
var current = dialogue[i];
var ouputs = current.OutputIds;
var currentOutputCount = current.OutputIds.Count;