Skip to content

Instantly share code, notes, and snippets.

View noroot's full-sized avatar
🎯
Focusing

noroot noroot

🎯
Focusing
View GitHub Profile
@noroot
noroot / IndexController.php
Created November 12, 2012 08:46 — forked from juriansluiman/IndexController.php
IndexController with "preDispatch" event simulation
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\ActionController
Zend\Mvc\MvcEvent;
class IndexController extends ActionController
{
public function indexAction()
@noroot
noroot / gist:4078414
Created November 15, 2012 12:29
Extjs: How to set default data sort
var myStore = new Ext.data.JsonStore({
fields: ['Item1', 'Item2', 'Item3', 'Item4']
, data: []
, sortOnLoad: true
, sorters: { property: 'Item1', direction : 'DESC' }
});
@noroot
noroot / hack.sh
Created November 25, 2012 17:23 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@noroot
noroot / npm-shortcurts.sh
Created November 27, 2012 07:18
Node shortcuts
npm install formidable@latest
@noroot
noroot / nodejs-env-dep.js
Created November 27, 2012 12:20
Environment dependency config
module.exports = function(){
switch(process.env.NODE_ENV){
case 'development':
return {dev setting};
case 'production':
return {prod settings};
default:
return {error or other settings};
@noroot
noroot / link button
Created November 29, 2012 08:43
Extjs Link Button
@noroot
noroot / gist:5532096
Created May 7, 2013 12:07
how to define console object if it doesn't defined
if (typeof(console) == 'undefined') {
var console = {
log: function(message) {},
info: function(message) {},
warn: function(message) {},
error: function(message) {
alert(message);
}
}
}
// # Twitter Bootstrap modal responsive fix by @niftylettuce
// * resolves #407, #1017, #1339, #2130, #3361, #3362, #4283
// <https://github.com/twitter/bootstrap/issues/2130>
// * built-in support for fullscreen Bootstrap Image Gallery
// <https://github.com/blueimp/Bootstrap-Image-Gallery>
// **NOTE:** If you are using .modal-fullscreen, you will need
// to add the following CSS to `bootstrap-image-gallery.css`:
//
// @media (max-width: 480px) {
@noroot
noroot / is-touch-device.js
Last active December 18, 2015 02:48
check for touch device in javascript
function isTouchDevice() {
var el = document.createElement('div');
el.setAttribute('ongesturestart', 'return;');
return typeof el.ongesturestart === "function";
}
@noroot
noroot / gist:6869042
Created October 7, 2013 14:36
Cocoa Touch request for address book access
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
// First time access has been granted, add the contact
});
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized)
{
// add the contact