Adds some snippets for web stuff
This commit is contained in:
		
							parent
							
								
									95a85a6893
								
							
						
					
					
						commit
						bd847bd812
					
				
					 4 changed files with 97 additions and 4 deletions
				
			
		
							
								
								
									
										52
									
								
								UltiSnips/css.snippets
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								UltiSnips/css.snippets
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
snippet centerm "centers an object by adding auto margin left and right"
 | 
			
		||||
margin-left: auto;
 | 
			
		||||
margin-right: auto;
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-block "Adds display block" Ab
 | 
			
		||||
display: block;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-iblock "Adds display inline-block" Ab
 | 
			
		||||
display: inline-block;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-inline "Adds display inline" Ab
 | 
			
		||||
display: inline;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-none "Adds display none" Ab
 | 
			
		||||
display: none;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-flex "Adds flex properties" Ab
 | 
			
		||||
display: flex;
 | 
			
		||||
flex-direction: ${1:row};
 | 
			
		||||
flex-wrap: ${2:nowrap};
 | 
			
		||||
justify-content: ${3:flex-start};
 | 
			
		||||
align-items: ${4:stretch};
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet d-iflex "Adds inline flex properties" Ab
 | 
			
		||||
display: inline-flex;
 | 
			
		||||
flex-direction: ${1:row};
 | 
			
		||||
flex-wrap: ${2:nowrap};
 | 
			
		||||
justify-content: ${3:flex-start};
 | 
			
		||||
align-items: ${4:stretch};
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet mleft "Margin Left" Ab
 | 
			
		||||
margin-left: $1;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet mright "Margin right" Ab
 | 
			
		||||
margin-right: $1;
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
							
								
								
									
										39
									
								
								UltiSnips/javascript.snippets
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								UltiSnips/javascript.snippets
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
priority 1000
 | 
			
		||||
snippet class "Adds a class"
 | 
			
		||||
class ${1:class_name}{
 | 
			
		||||
	/**
 | 
			
		||||
	 * this function is run as soon as possible.
 | 
			
		||||
	 * the dom isn't neccessarily loaded / parsed
 | 
			
		||||
	**/
 | 
			
		||||
	constructor(){
 | 
			
		||||
		//Bind this in the following functions to the class
 | 
			
		||||
		this.domloaded = this.domloaded.bind(this);
 | 
			
		||||
 | 
			
		||||
		//check to see if the dom has loaded yet
 | 
			
		||||
		if(document.readystate == "loading"){
 | 
			
		||||
			//if the dom hasn't loaded, wait until it is
 | 
			
		||||
			document.addeventlistener("readystatechange",this.domloaded);
 | 
			
		||||
			return;
 | 
			
		||||
		} else {
 | 
			
		||||
			//if it has, run the domloaded function
 | 
			
		||||
			this.domloaded();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * this function is run as soon as the dom is loaded
 | 
			
		||||
	**/
 | 
			
		||||
	domloaded(){
 | 
			
		||||
		//make sure we don't run this twice
 | 
			
		||||
		document.removeEventListener("readystatechange",this.domloaded);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
new $1();
 | 
			
		||||
$0
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet bind "creates a bind statement"
 | 
			
		||||
this.${1:functionName} = this.$1.bind(this);
 | 
			
		||||
endsnippet
 | 
			
		||||
							
								
								
									
										1
									
								
								UltiSnips/less.snippets
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								UltiSnips/less.snippets
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
extends css
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue