This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('app', ['restangular']) | |
/** ServerSide validation presenter **/ | |
.factory('Validator', function(){ | |
return { | |
clean: function($form) { | |
if (typeof $form == 'string') { | |
$form = angular.element('form[name="'+$form+'"]').controller('form'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
buildToolsVersion "24.0.0" | |
compileSdkVersion 24 | |
sourceSets { | |
main { | |
manifest.srcFile 'AndroidManifest.xml' | |
java.srcDirs = ['src'] | |
aidl.srcDirs = ['src'] | |
renderscript.srcDirs = ['src'] | |
res.srcDirs = ['res'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// memorization for performance; don't use this for mutable function | |
function memorize(fun) { | |
const cache = {}; | |
return function(){ | |
const args = Array.prototype.slice.call(arguments); | |
const key = JSON.stringify(args); | |
// fetch | |
let hit = cache[key]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 은/는, 을/를, 이/가, 과/와 조사 치환 (마지막 글자의 종성이 있는 경우 첫째 조사, 종성이 없는 경우 둘째 조사 채택) | |
var josas = map[string][]string{ | |
"은/는": { "은", "는" }, | |
"을/를": { "을", "를" }, | |
"이/가": { "이", "가" }, | |
"과/와": { "과", "와" }, | |
"는/은": { "은", "는" }, | |
"를/을": { "을", "를" }, | |
"가/이": { "이", "가" }, | |
"와/과": { "과", "와" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# icloud sync management shell functions | |
# Simple usage | |
$ nosync ./node_modules | |
$ resync ./some_dir ./and_dir ./and/deep/file_or_whatever | |
# example to call with pipe: | |
$ find ./test -type file | xargs -I{} zsh -c 'source ~/.zshrc && nosync {}' | |
$ ls -al test | |
total 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
kubectl get deploy --all-namespaces \ | |
-l telepresence \ | |
-o custom-columns=namespace:.metadata.namespace,name:.metadata.name,age:.metadata.creationTimestamp \ | |
| awk -v yesterday=`date -u -v -1d +%FT%TZ` \ | |
'{if ($3 < yesterday) system("kubectl delete deploy --grace-period=0 -n " $1 " " $2) }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getSizeOfObject = obj => { | |
const typeSizes = { | |
"undefined": () => 0, | |
"boolean": () => 4, | |
"number": () => 8, | |
"string": item => 2 * item.length, | |
"object": item => !item ? 0 : Object | |
.keys(item) | |
.reduce((total, key) => sizeOf(key) + sizeOf(item[key]) + total, 0) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anchor_lang::{AnchorDeserialize, Discriminator}; | |
use solana_sdk::pubkey::Pubkey; | |
use solana_sdk::pubkey; | |
use solana_client::nonblocking::rpc_client::RpcClient; | |
const ID: Pubkey = pubkey!("fragnAis7Bp6FTsMoa6YcH8UffhEw43Ph79qAiK3iF3"); | |
const NSOL_POOL: Pubkey = pubkey!("AkbZvKxUAxMKz92FF7g5k2YLCJftg8SnYEPWdmZTt3mp"); | |
const NSOL_POOL_DISCRIMINATOR: [u8; 8] = [7, 113, 233, 177, 153, 66, 175, 56]; | |
#[derive(AnchorDeserialize, Clone, Debug)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn receipt_token_extra_account_metas() -> Result<Vec<ExtraAccountMeta>> { | |
let extra_account_metas = vec![ | |
// index 5, fund account | |
ExtraAccountMeta::new_with_seeds( | |
&[ | |
Seed::Literal { | |
bytes: FundAccount::SEED.to_vec(), | |
}, | |
Seed::AccountKey { index: 1 }, // receipt_token_mint | |
], |