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 / 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")
function removeElement(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
@ajace
ajace / httprequest.js
Created August 29, 2013 19:55
Javascript ajax snippet from Mozilla
(function() {
document.getElementById...
.onclick = function() { sendHTTPRequest(); };
var httpRequest;
function sendHTTPRequest() {
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
httpRequest = new XMLHttpRequest();
@ajace
ajace / draganddrop
Created August 26, 2013 14:08
Javascript drag and drop with progress notification
function(file, index){
var url = module.attr('data-upload');
var xhr = new XMLHttpRequest(),
formData = new FormData(),
previewImage,
img;
xhr.upload.addEventListener("progress", function (event) {
$progress.stop().css('width', 0);
@ajace
ajace / twitter.1.1.php
Created August 5, 2013 14:22
Twitter Api v1.1
public function curl_fetch ( $id, $since ) {
/*** Twitter Api v1.1 ***/
$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
$count = $this->_app->count;
$sinceUrl = $since != false ? "&since_id={$since}" : '';
$oauth_access_token = $this->_app->oauth_access_token;
$oauth_access_token_secret = $this->_app->oauth_access_token_secret;
$consumer_key = $this->_app->consumer_key;
@ajace
ajace / laravel_paths
Last active December 20, 2015 15:39
Laravel 4 paths
<?php
// /Illuminate/Support/helpers.php
echo app_path();
echo base_path();
echo public_path();
echo storage_path();
@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 / i-mediaqueries.scss
Created July 26, 2013 03:32
ipad and iphone media queries. example use: @media #{$desktop}
$ipad: "only screen and (min-width: 569px) and (max-width: 1024px)";
$ipad-l: "only screen and (min-width: 769px) and (max-width: 1024px)";
$ipad-p: "only screen and (min-width : 481px) and (max-width : 768px)";
$iphone: "only screen and (min-width: 320px) and (max-width: 568px)";
$iphone-l:"only screen and (min-width: 321px) and (max-width: 568px)";
$iphone-p: "only screen and (max-width: 320px)";
$desktop: "only screen and (min-width: 1224px)";