Skip to content

Instantly share code, notes, and snippets.

View ajace's full-sized avatar

Ace Atienza ajace

  • Cainkade
  • New York, NY
View GitHub Profile
@ajace
ajace / prime_generator.js
Last active October 5, 2020 03:03
nodejs script to generate prime numbers
#!/usr/bin/env node
var fs = require('fs');
var outfile = "primes.txt";
var count = 0;
var maxCount = 100;
var primes = [];
var i = 2;
@ajace
ajace / .vimrc
Created July 29, 2013 03:25
my .vimrc for Web Development. PHP, Javascript, HTML, CSS, Ruby
set nocompatible
"Enable filetypes
filetype on
filetype plugin on
filetype indent on
syntax on
"Write the old file out when switching between files.
set autowrite
@ajace
ajace / SSMA
Created June 21, 2017 20:54
SSMA migration from MySql to SQL Server
SSMA
General Solutions for migration
1. Update Mysql DB
2. SSMA > Table > Refresh from DB
3. SSMA > Table > Convert Schema
4. SSMA > SQL Server Table > Synchronize with Database
5. SSMA > MySQL Table > Migrate Data
6. Apply previous MySQL logic in MSSQL equivalent (most should be possible) in separate query
@ajace
ajace / strings.xml
Created January 23, 2017 20:36
Use CDATA along with string formatting for hyperlinks (Android)
<string name="link"> <![CDATA[<a href="%1$s"><u>%2$s</u></a>]]> </string>
@ajace
ajace / $.ajax.form.submit.js
Created January 15, 2014 19:22
ajax form submittal using jquery; useful inside of iframes since .submit() doesn't work
var url = location.origin;
var form = $('').serialize();
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: form,
}).done(function(data){
console.log("success");
@ajace
ajace / array_keys_i.php
Created December 18, 2013 20:42
PHP: array keys search for insensitive input
function array_keys_i($array, $str){
$results = array();
foreach($array as $key => $value) {
if(stristr($str,$value)) {
$results[] = $key;
}
}
if(empty($results)) {
@ajace
ajace / initial_setup.sh
Last active December 26, 2015 17:49
Ubuntu 14.10 web development setup
#!/bin/sh
# chmod +x initial_setup.sh
# sudo ./initial_setup.sh
sudo apt-get install -y \
curl \
vim \
git \
alacarte \
@ajace
ajace / mac_osx_setup.sh
Last active December 25, 2015 19:39
Setup for a new mac osx. Web Development
#!/bin/bash
# zsh
# uninstall_oh_my_zsh
curl -L github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
# http://bahoom.com/hyperswitch
defaults write com.apple.Finder AppleShowAllFiles TRUE
killall Finder
@ajace
ajace / walkTheDom.js
Created September 16, 2013 18:45
Crockford's WalkTheDom ex: var root = document.getElementById('div'); walkTheDOM(root, function(node) { console.log( node.nodeName ); });
function walkTheDOM(node, func) {
func(node);
node = node.firstChild;
while (node) {
walkTheDOM(node, func);
node = node.nextSibling;
}
}
function dom(name, attributes) {
var node = document.createElement(name);
if (attributes) {
forEachIn(attributes, function(name, value) {
setNodeAttribute(node, name, value);
});
}
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child == "string")