Skip to content

Instantly share code, notes, and snippets.

View sean7218's full-sized avatar
🛠️

Sean Zhang sean7218

🛠️
View GitHub Profile
@Mazuh
Mazuh / .gitlab-ci.yml
Last active May 13, 2022 04:53
Example of gitlab CI/CD for a create-react-app application on Amazon S3 Bucket.
image: nikolaik/python-nodejs:latest
stages:
- install
- test
- deploy
prodInstall:
stage: install
script:
@katydorjee
katydorjee / For loop in Ampscript.html
Created March 28, 2017 07:08
For loop in Ampscript
%%[
SET @pl = "a|b|c|d|e"
SET @prefArray = BuildRowSetFromString(@pl,"|")
SET @rCount = RowCount(@prefArray)
FOR @i = 1 TO @rCount DO
SET @ddd = Field(Row(@prefArray, @i),1)
]%%
%%=V(@ddd)=%% <br>
%%[
NEXT @i
@skyebook
skyebook / CVPixelBufferPixelFormatNames.swift
Created March 24, 2017 15:26
Easily get the pixel format name of a CVPixelBuffer
public func CVPixelBufferGetPixelFormatName(pixelBuffer: CVPixelBuffer) -> String {
let p = CVPixelBufferGetPixelFormatType(pixelBuffer)
switch p {
case kCVPixelFormatType_1Monochrome: return "kCVPixelFormatType_1Monochrome"
case kCVPixelFormatType_2Indexed: return "kCVPixelFormatType_2Indexed"
case kCVPixelFormatType_4Indexed: return "kCVPixelFormatType_4Indexed"
case kCVPixelFormatType_8Indexed: return "kCVPixelFormatType_8Indexed"
case kCVPixelFormatType_1IndexedGray_WhiteIsZero: return "kCVPixelFormatType_1IndexedGray_WhiteIsZero"
case kCVPixelFormatType_2IndexedGray_WhiteIsZero: return "kCVPixelFormatType_2IndexedGray_WhiteIsZero"
case kCVPixelFormatType_4IndexedGray_WhiteIsZero: return "kCVPixelFormatType_4IndexedGray_WhiteIsZero"
@startupcode
startupcode / HtmlToAttributedString.swift
Last active October 3, 2023 01:08
Swift - Assign HTML to NSAttributedString with custom FONT
//Usage
lbl.attributedText = htmlToAttributedString ("html text")
//Assign attributed string
func htmlToAttributedString(string : String) -> NSAttributedString{
var attribStr = NSMutableAttributedString()
do {//, allowLossyConversion: true
attribStr = try NSMutableAttributedString(data: string.dataUsingEncoding(NSUnicodeStringEncoding)!, options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil)
@KainokiKaede
KainokiKaede / DropboxSyncv2.py
Last active September 19, 2018 14:48 — forked from wrenoud/DropboxSync.py
DropboxSync
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import pickle
import console
import editor
import dropbox
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
@KainokiKaede
KainokiKaede / dropboxloginv2.py
Last active October 10, 2017 07:33 — forked from omz/dropboxlogin.py
dropboxlogin
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
from __future__ import absolute_import
from __future__ import print_function
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
import webbrowser
import dropbox
@wrenoud
wrenoud / DropboxSync.py
Created November 10, 2012 02:46
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
@omz
omz / dropboxlogin.py
Created November 7, 2012 21:16
dropboxlogin
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'
@mattratleph
mattratleph / vimdiff.md
Last active April 24, 2024 11:28 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@rocarvaj
rocarvaj / .vimrc
Created April 27, 2012 21:28
Minimal .vimrc for C/C++ developers
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)