Skip to content

Instantly share code, notes, and snippets.

@oraricha
oraricha / JSONView Dark Theme.css
Created October 23, 2017 08:37 — forked from shirish87/JSONView Dark Theme.css
This is a dark theme for JSONView chrome extension
body {
white-space: pre;
font-family: monaco, Consolas, Menlo, monospace;
color: white;
background: #282a36;
font-size: 12px;
line-height: 1.5m;
}
.property {
@oraricha
oraricha / iphone-simulator.sh
Last active July 18, 2016 13:23
iphone simulator command line
open -a Simulator --args -71CC06B3-D28F-4414-AA44-FA9A6A3D0403
#create more ids:
xcrun simctl list
@oraricha
oraricha / Mac SSH Autocomplete
Created June 29, 2016 13:01 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@oraricha
oraricha / urlRegex.js
Last active August 29, 2015 14:13
url regex for ftp/http/https, can be without protocol name as well - using with contenteditable
var urlRegex = /^((?:ftp|http|https)?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i;
/* the following will enforce appearance of 'www' while the protocol is optional, but if appears, must be correct */
urlRegex = /^((ftp|http|https)?:(\/\/)|(w{3}\.))((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i;
/*check url on contenteditable element*/
var currentText,
$element = $("[contenteditable='true']");
var replaceAll = function (find, replace, str) {
// http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
module.exports = function(grunt) {
/**
* Saves having to declare each dependency
*/
require( "matchdep" ).filterDev( "grunt-*" ).forEach( grunt.loadNpmTasks );
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

AngularJS

AngularJS is somewhere in between a framework and a library, and as such it lets us benefit of both worlds:

As a library it:

  • Doesn't require a particular layout of files at development time
  • Is lightweight and small in size (79kb)
  • Works great with other technologies. Add as much or as little of AngularJS to an existing page as we like, and as much or as little of other libraries as well
  • Is modular - every feature can be modified or replaced to suit our unique development workflow and feature needs
  • Has no global state and multiple apps can run on a single page without the use of iframes
(function( $ ) {//my scope
var _obj = {},//container for plugin
_appName = 'MYDEFAULTPLUGINNAME';//will be visible in global scope, use unique name
_obj[_appName] = window[_appName] = new function(){//exposing to global scope
var _ = {//private methods
defaults:{},
settings:{},
l:function(severity, message) {
var _args = Array.prototype.slice.apply(arguments);
console[severity](_appName + ' :: ' + _args.slice(1, 2), _args.slice(2));