Skip to content

Instantly share code, notes, and snippets.

View omelsoft's full-sized avatar

Cromwell Bayon omelsoft

View GitHub Profile
@omelsoft
omelsoft / getcookiebyname.js
Created August 24, 2017 08:23 — forked from meandmax/getcookiebyname.js
get the cookie value by name if a cookie name exists.
/**
* get cookie by name without using a regular expression
*/
var getCookie = function(name) {
var getCookieValues = function(cookie) {
var cookieArray = cookie.split('=');
return cookieArray[1].trim();
};
var getCookieNames = function(cookie) {
@omelsoft
omelsoft / aps.upload.file.directive.js
Last active September 26, 2017 11:48
AngularJS File Upload using Material Design
angular.module('MyApp')
.controller('AppCtrl', function($scope) {
}).directive('apsUploadFile', apsUploadFile);
function apsUploadFile() {
var directive = {
restrict: 'E',
template: '<input id="fileInput" type="file" class="ng-hide"> <md-button id="uploadButton" class="md-raised md-primary" aria-label="attach_file"> Choose file </md-button><md-input-container md-no-float> <input id="textInput" ng-model="fileName" type="text" placeholder="No file chosen" ng-readonly="true"></md-input-container>',
@omelsoft
omelsoft / Advance-Custom-Fields.php
Last active October 7, 2017 04:48
How to Update and Save Advance Custom Fields data within a Wordpress Loop
<?php
/**
* The purpose of this is that I was using an old Wordpress theme which generates a custom fields. Those fields will only be available
* when that theme is active. So when switching theme, all the posts meta data will not be inherited by the new theme.
*
* Note: Old theme is currently active
*
* So, I decided to use Advance Custom Fields and created fields for each keys used by the old theme. I was able to retrieve the key-values
* from the old theme and saved the values to the newly created ACF fields by iterating over each post. By simple using a sample snippet:
*
@omelsoft
omelsoft / pldt-home-fibr-an5506-04-fa-rp2616-advanced-settings.md
Created April 10, 2018 09:04 — forked from kleo/backspace.md
PLDT HOME FIBR AN5506-04-FA RP2616 Advanced Settings

PLDT HOME FIBR AN5506-04-FA RP2616 Advanced Settings

By default the PLDT HOME FIBR AN5506-04-FA RP2616 comes only with limited settings.

Hidden from the web interface are the rest of the router's capabilities and advanced settings.

We just need to enter the right url for the settings you're looking for.

We need to be logged in before we can do anything else, use your defined password if you already set the admin password.

@omelsoft
omelsoft / cache-busting.js
Last active February 16, 2020 20:18 — forked from haydenbr/cache-busting.js
ionic cache busting
#!/usr/bin/env node
var fs = require('fs'),
path = require('path'),
cheerio = require('cheerio'),
revHash = require('rev-hash');
/**
*
* @param string fileName
@omelsoft
omelsoft / wikipedia.service.ts
Created April 12, 2018 20:11 — forked from P1xt/wikipedia.service.ts
Setting headers on an Angular 2 http get request
import { Injectable } from '@angular/core';
import { Http, Headers, Response } from '@angular/http';
@Injectable()
export class GetWikipediaService {
constructor(private http: Http) { }
searchWiki = (query) => {
@omelsoft
omelsoft / object-to-array.pipe.ts
Created November 2, 2018 09:02 — forked from clamarque/object-to-array.pipe.ts
A pipe for Angular2 - Transform Object to Array
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'keys'})
export class KeysPipe implements PipeTransform {
transform(value, args:string[]) : any {
let keys = [];
for (let key in value) {
keys.push({key: key, value: value[key]});
}
return keys;
@omelsoft
omelsoft / Common-Currency.json
Created March 21, 2020 11:45 — forked from ksafranski/Common-Currency.json
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@omelsoft
omelsoft / system
Created May 2, 2020 02:48
Free up "system pid 4 port 80" on windows
I have XAMPP installed locally but I couldn't let apache run on the default port 80. Although, there's a way we can change the port to something like 8080 or 81. But I want my Apache server to run on port 80.
The System Process has PID of 4 which means you need to disable the HTTP.sys driver which is started on demand by another service, such as Windows Remote Management or Print Spooler on Windows 7 or 2008.
To do this, you need to run the following in the command prompt with an elevated Administrator priveleges.
netsh http add iplisten ipaddress=0.0.0.0