Skip to content

Instantly share code, notes, and snippets.

@odixon
odixon / 0_reuse_code.js
Last active August 29, 2015 14:18
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
@odixon
odixon / meta-tags.md
Created January 3, 2017 20:18 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
/**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
@odixon
odixon / parseTime.js
Created February 10, 2017 20:07 — forked from claviska/parseTime.js
Parse time strings input by humans
function parseTime(time, format, step) {
var hour, minute, stepMinute,
defaultFormat = 'g:ia',
pm = time.match(/p/i) !== null,
num = time.replace(/[^0-9]/g, '');
// Parse for hour and minute
switch(num.length) {
case 4:
@odixon
odixon / replace_master_w_branch
Created May 31, 2017 13:49 — forked from geekforbrains/replace_master_w_branch
Replace master with branch
git checkout <branch>
git merge -s ours master
git checkout master
git merge <branch>
@odixon
odixon / replace_master_w_branch
Created May 31, 2017 13:49 — forked from geekforbrains/replace_master_w_branch
Replace master with branch
git checkout <branch>
git merge -s ours master
git checkout master
git merge <branch>
@odixon
odixon / pdf-thumbnail-php.md
Created July 6, 2017 13:19 — forked from umidjons/pdf-thumbnail-php.md
Creating PDF thumbnails in PHP

Creating PDF thumbnails in PHP

Install Ghostscript

Download and install right version of ghostscript. In my case my PHP was x86 architecture, so I download Ghostscript 9.14 for Windows (32 bit).

Enable ImageMagick

@odixon
odixon / openssl_encrypt_decrypt.php
Created September 20, 2017 14:20 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@odixon
odixon / PushNotifications.php
Created January 16, 2018 17:12 — forked from joashp/PushNotifications.php
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@odixon
odixon / make_api_calls_php.php
Created January 16, 2018 17:14 — forked from joashp/make_api_calls_php.php
Make API Calls in PHP
<?php
function CallAPI($method, $url, $data = false) {
$curl = curl_init();
switch ($method)
{
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);