Skip to content

Instantly share code, notes, and snippets.

@oraricha
oraricha / JSONView Dark Theme.css
Created Oct 23, 2017 — forked from shirish87/JSONView Dark Theme.css
This is a dark theme for JSONView chrome extension
View JSONView Dark Theme.css
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 Jul 18, 2016
iphone simulator command line
View iphone-simulator.sh
open -a Simulator --args -71CC06B3-D28F-4414-AA44-FA9A6A3D0403
#create more ids:
xcrun simctl list
@oraricha
oraricha / Mac SSH Autocomplete
Created Jun 29, 2016 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
View Mac SSH Autocomplete
_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 Aug 29, 2015
url regex for ftp/http/https, can be without protocol name as well - using with contenteditable
View urlRegex.js
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) {
View Gruntfile.js
// 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'),
View gist:11213942

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
View plugin.js
(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));