Skip to content

Instantly share code, notes, and snippets.

View reyramos's full-sized avatar
💭
I may be slow to respond.

Rey Ramos reyramos

💭
I may be slow to respond.
View GitHub Profile
@reyramos
reyramos / pdf-fool.ts
Created April 18, 2025 17:41
Read PDF File and export to new PDF file
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
import { PDFDocumentProxy } from 'pdfjs-dist';
import { jsPDF } from "jspdf";
pdfjsLib.GlobalWorkerOptions.workerSrc = '/assets/vendors/pdf.worker.mjs';
const str = 'base64,'
export class PDFFool {
@reyramos
reyramos / HorizontalPicker.js
Created June 22, 2021 10:29 — forked from jevakallio/HorizontalPicker.js
React Native Horizontal Picker
// @flow
// https://twitter.com/jevakallio/status/941258932529614848
import React, { Component, type Node } from 'react';
import styled from 'styled-components/native';
import Touchable from 'react-native-platform-touchable';
import Carousel from 'react-native-snap-carousel';
// $FlowFixMe
import { LinearGradient } from 'expo';
@Injectable()
export class RlBlockUiRequestInterceptor implements HttpInterceptor {
rlBlockUiService: RlBlockUiService;
// Use a forwardRef as the RlBlockUiService is defined/exported in the same file
constructor( @Inject(forwardRef(() => RlBlockUiService)) rlBlockUiService: RlBlockUiService){
this.rlBlockUiService = rlBlockUiService;
}
@reyramos
reyramos / speed_gps.js
Created March 3, 2017 19:34
Get the speed differential from 2 Longitude and Latitude points.
/**
* Created by ramor11 on 3/3/2017.
*/
function distance_on_geoid(lat1, lon1, lat2, lon2) {
// Convert degrees to radians
lat1 = lat1 * Math.PI / 180.0;
lon1 = lon1 * Math.PI / 180.0;
@reyramos
reyramos / compile_link.js
Last active November 7, 2016 13:39
Angular demonstration of Compile controller to link with DOM element
@reyramos
reyramos / .htaccess
Created October 30, 2016 10:59
htaccess
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@reyramos
reyramos / jquery.format.js
Created April 5, 2016 18:40 — forked from mdellavo/jquery.format.js
Format phone number/credit card/ssn/etc inputs by regular expression
(function() {
var formatters = {
'phone' : [/^\(?\s?(\d{3})\s?\)?\s?\-?\s?(\d{3})\s?\-?\s?(\d{4})$/, '($1) $2-$3' ],
'ssn' : [/^(\d{3})\s?\-?\s?(\d{2})\s?\-?\s?(\d{3})$/, '$1-$2-$3' ],
'creditcard' : [/^(\d{4})\s?\-?\s?(\d{4})\s?\-?\s?(\d{4})\s?\-?\s?(\d{4})$/, '$1-$2-$3-$4']
};
jQuery.fn.formatWith = function(regex, replacement) {
$(this).change(function() {
this.value = this.value.replace(regex, replacement);
@reyramos
reyramos / doWork2.js
Created April 15, 2015 14:05
Webworker for angular Controller example
self.addEventListener('message', function (e) {
var data = e.data;
if (typeof (data) === "undefined") return;
switch (data.cmd) {
case 'start':
@reyramos
reyramos / webworkerController.js
Last active August 29, 2015 14:19
angular Controller example calling webworker
'use strict';
/**
* # Application
*
* Core Application controller that includes functions used before we kickStart the Application
* The functions store within this files live outside of the ngView and are used as global function
*/
angular.module('app').controller(
'webworkerController', [
'$rootScope',
@reyramos
reyramos / Package Control.sublime-settings
Created March 18, 2015 20:43
Package Control.sublime-settings
{
"in_process_packages":
[
],
"installed_packages":
[
"AngularJS",
"AngularJS Snippets",
"Code Snippets Helper",
"CSS Format",