Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Andrii Lundiak alundiak

👋
View GitHub Profile
View pattern1.js
var articlesPattern = /( a | an | the )/
@alundiak
alundiak / multipart.html
Last active Dec 17, 2015
digital-javascript
View multipart.html
<form id="myForm" name="myForm" enctype="multipart/form-data" method="POST"
data-bind="submit: pseudoSubmitForm">
<select data-bind="options: uiTypes,
optionsText: 'typeLabel',
optionsValue: 'typeValue',
value: selectedType,
optionsCaption: 'Choose...'">
</select>
View multipart.js
(function (){
var node = document.getElementById('myForm');
function AppViewModel() {
this.uiTypes = ko.observableArray([
{"typeValue":"A", "typeLabel": "1 field type"},
{"typeValue":"B", "typeLabel": "2 fields type"}
]);
@alundiak
alundiak / osx_defaults.sh
Last active Jan 30, 2016
Script, which sets some OS X defaults into non-default state
View osx_defaults.sh
# http://osxdaily.com/2010/02/12/how-to-quit-the-finder/
defaults write com.apple.finder QuitMenuItem -bool true && killall Finder # false #default
# Finder. Show All
defaults write com.apple.finder AppleShowAllFiles true #false #default
# Enable the debug menu and restart the Mac App Store.
defaults write com.apple.appstore ShowDebugMenu -bool true # false #default
# Use Plain Text Mode as Default
@alundiak
alundiak / wifiscript.sh
Created Jan 30, 2016
Script, which watch wifi network, and in case of errors, restart it
View wifiscript.sh
#! /usr/bin/env bash
### setup some variables
# Copied from https://discussions.apple.com/thread/6619286?start=15&tstart=0
wifiInterface="en0" # changed from en2 to en0, coz in my case, en0 has 192.168.0.12
wifiIP=$(ipconfig getifaddr "$wifiInterface")
echo "Watching" $wifiInterface "on" $wifiIP
View datePickerDateFormatIssue.html
<input type="text" id="dateFrom" name="dateFrom" required ng-disabled="whatever"
ng-model="model.data.dateFrom" bs-datepicker autoclose="true"
data-date-format="MM-dd-yyyy"
/>
View normalizelf_vs_trim.js
exec: {
user: {
cmd: 'echo %USERPROFILE%',
stdout: false,
callback: function(varX, stdout){
// trim used to get rid of Windows: \n. For some reason "grunt.util.normalizelf(stdout)" doesn't work
grunt.config.set("userProfileFolder", stdout.trim());
}
}
}
View filter.js
{
"data": {
"filters":[
{"name":"pending","count":155, "order": 2},
{"name":"processing","count":0,"order": 3},
{"name":"open","count":0, "order": 1}
]
}
}
@alundiak
alundiak / 0_json_data.json
Last active Jan 30, 2016
i18n.js Example
View 0_json_data.json
// rest response in JSON format.
{
"statuses": [{
"name": "open",
"count": 2
}, {
"name": "pending",
"count": 1
}, {
View git-config.sh
git config --get-all user.name #local repo git config file.
git config --global --get-all user.name #user config file.
git config --system --get-all user.name #system git config file.
git config --global user.name "Andrii Lundiak"
git config --global user.email "landike@gmail.com"
git config --global credential.helper store # if I'm lazy to type password always or setup SSH keys
git config --global push.default simple #
# https://git-scm.com/docs/gitattributes