This file contains 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::prelude::*; | |
// use borsh::{BorshDeserialize, BorshSerialize}; | |
#[program] | |
pub mod drop { | |
use super::*; | |
pub fn initialize_mint(ctx: Context<CreateMint>, supply: u64, decimals: u8, authority: Pubkey) -> ProgramResult { | |
let mint = &mut ctx.accounts.mint; |
This file contains 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 { MerkleTree } = require('merkletreejs') | |
const SHA256 = require('crypto-js/sha256') | |
let users = initializeUsers(256); | |
function addAddress(index, address) { | |
users[index] = address; | |
} | |
function verifyProof(sorted, hex){ |
This file contains 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
# ------------------------------------------------------------------------- | |
# convert .mov file into segments of .mp4 files. I use it to create 60 sec video for my insta cooking channel with one command | |
# vsplit "original.mov" segment_span_in_seconds # "$(( 1*59 ))" | |
# this is inefficient but it works and I don't want to dig deeper into ffmpeg | |
# ------------------------------------------------------------------------- | |
vsplit() { | |
SRC="$1" | |
ffmpeg -i "$SRC" -qscale 0 output.mp4 | |
ffmpeg -i output.mp4 -c:v libx264 -crf 22 -map 0 -segment_time ${2} -g 9 \ | |
-sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" \ |
This file contains 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
post_test = Post.new | |
parser_test = Parser.new | |
parser_test.open_file('html-samples/hacker-news-post.html') | |
parser_test.comment_args.each do |comment_hash| | |
post_test.add_comment(Comment.new(comment_hash)) | |
end | |
post_test.comments |
This file contains 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 object = { | |
method : function() { code block}, | |
} |
This file contains 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
for (property in objectName) { | |
code block | |
} |
This file contains 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
objectName.property | |
objectName["String Key"] | |
objectName[expression_or_variable] |
This file contains 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
delete objectName.property |
This file contains 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
objectName.newProperty = value |
This file contains 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
anotherCar = Object.create( car ); | |
anotherCar.manufacturer = "McLaren"; | |
anotherCar.model = "P1"; | |
console.log( anotherCar ); // Object {manufacturer: "McLaren", model: "P1"} | |
console.log( car ); // Object {manufacturer: "Bugatti", model: "Veyron"} |
NewerOlder