Skip to content

Instantly share code, notes, and snippets.

View johncrisostomo's full-sized avatar
🌏
Not much contrib here as my org is now using a ADO exclusively

John Crisostomo johncrisostomo

🌏
Not much contrib here as my org is now using a ADO exclusively
  • JLL Technologies
  • Singapore
View GitHub Profile
@johncrisostomo
johncrisostomo / publication.js
Created May 7, 2018 01:13
gagarin client testing
import { Categories, Products } from '/lib/collections';
import {Meteor} from 'meteor/meteor';
import {check} from 'meteor/check';
export default function () {
Meteor.publish('categoriesList', () => {
return [
Categories.find(),
@johncrisostomo
johncrisostomo / README.md
Created May 7, 2018 01:06
Save files in Meteor

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@johncrisostomo
johncrisostomo / lighboxnamalupet.html
Created July 30, 2012 08:40
wala, lightbox lang naman.
<!DOCTYPE html>
<html>
<head>
<title>LIGHTBOX NA MALUPET</title>
<style>
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
@johncrisostomo
johncrisostomo / shortener.py
Created September 13, 2011 18:08
bit.ly shortener cli
#!/usr/bin/env python
# URL SHORTENER CLI v0.01 by 4R5C4R105U5
# CREATED ON SEPT. 14, 2011
# GUI COMING SOON
import urllib
api = "" # I LEFT THIS BLANK ON PURPOSE
login = "" # LEFT BLANK ON PURPOSE AS WELL, USE YOUR OWN LOGIN AND API KEY! :D
user_url = raw_input('Enter url to be shortened : ')
@johncrisostomo
johncrisostomo / sieve.rb
Created July 13, 2011 12:57
Sieve of Eratosthenes in Ruby
print "Enter maximum number : "
n = gets.to_i
primes = (2..n).to_a
i = 0
while primes[i]**2 < primes.last
prime = primes[i]
primes = primes.select { |num| num == prime || num % prime != 0 }
@johncrisostomo
johncrisostomo / sieve.rb
Created July 13, 2011 12:56
Sieve of Eratosthenes in Ruby
print "Enter maximum number : "
n = gets.to_i
primes = (2..n).to_a
i = 0
while primes[i]**2 < primes.last
prime = primes[i]
primes = primes.select { |num| num == prime || num % prime != 0 }
@johncrisostomo
johncrisostomo / Age.java
Created June 10, 2011 09:10
lab lecture
import java.io.*;
public class Age {
public static void main(String args[]) throws IOException {
int age;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter your age : ");
age = Integer.parseInt(br.readLine());
System.out.println("Your age is " + age);
}
@johncrisostomo
johncrisostomo / experimental.rb
Created May 29, 2011 22:31
Text Analyzer (reusable) with a logging feature
require 'logger'
class TextAnalyzer
def initialize(fname)
@log = Logger.new('TextAnalyzerClass.log', 'monthly')
@log.progname = $0
@text = ''
@output = ''
File.open(fname) do |f|
while line = f.gets
@johncrisostomo
johncrisostomo / analyzer2.rb
Created May 29, 2011 11:29
Text Analyzer with error handling and logging
require 'logger'
$LOG = Logger.new('analyzer.log', 'monthly')
def document_to_string(filename)
$LOG.debug("File name : #{filename}")
text = ''
begin
File.open(filename) do |f|
while line = f.gets
@johncrisostomo
johncrisostomo / mp3tagreader.rb
Created May 28, 2011 21:26
MP3 ID3 Tag Reader
filename = ARGV
fields_and_sizes = [[:track_name, 30], [:artist_name, 30],[:album_name, 30], [:year, 4], [:comment, 30],
[:genre, 1]]
tag = Hash.new
File.open(filename.first) do |f|
f.seek(-128, IO::SEEK_END)
if f.read(3) == 'TAG'
fields_and_sizes.each do |field, size|