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
let g:netrw_banner = 0 | |
let g:netrw_liststyle = 3 | |
let g:netrw_browse_split = 4 | |
let g:netrw_altv = 1 | |
let g:netrw_winsize = 25 | |
augroup ProjectDrawer | |
autocmd! | |
autocmd VimEnter * :Vexplore | |
augroup END |
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 | |
find . -name '*.js' | xargs wc -l |
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
struct tm tm; | |
std::string dateString = "2016-04-29T00:30:29.016448Z" | |
strptime(dateString.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm); | |
int day = tm.tm_mday, month = tm.tm_mon + 1, year = tm.tm_year + 1900, hour = tm.tm_hour, min = tm.tm_min; |
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
#include "cinder/app/App.h" | |
#include "AssetDataSource.h" | |
using namespace ci; | |
using namespace ci::app; | |
void AssetDataSource::OnRequest(int request_id, const WebString & path) { | |
// load the asset the Cinder way and convert it to a buffer | |
auto asset = loadAsset(toString(path)); |
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
from vec import Vec | |
from random import randrange | |
from operator import itemgetter | |
# The raw data points | |
raw_data = [ | |
(41, 45),(39, 44),(42, 43),(44, 43),(10, 42),(38, 42), | |
(8, 41),(41, 41),(13, 40),(45, 40),(7, 39),(38, 39), | |
(42, 39),(9, 38),(12, 38),(19, 38),(25, 38),(6, 37), | |
(13, 35),(9, 34),(12, 34),(32, 27),(26, 25),(39, 24), |
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
from math import sqrt | |
class Vec(): | |
@staticmethod | |
def distance(v1, v2): | |
delta = v1 - v2 | |
return sqrt(delta.x ** 2.0 + delta.y ** 2.0) | |
@staticmethod |
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
import SceneKit | |
class Geometry : NSObject { | |
// Creates a geometry object from given vertex, index and type data | |
internal func createGeometry(vertices:[SCNVector3], indices:[Int32], primitiveType:SCNGeometryPrimitiveType) -> SCNGeometry { | |
// Computed property that indicates the number of primitives to create based on primitive type | |
var primitiveCount:Int { | |
get { |
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
import Foundation | |
import SceneKit | |
class Icosahedron : Geometry { | |
// The golden ratio | |
static let t = (1.0 + sqrt(5.0)) / 2.0; | |
// These vertices represent three orthogonal rectangles | |
// The corners of which define the 12 vertices of an icosahedron | |
// We get the normalized vector so that our points are on the unit sphere |
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
import SceneKit | |
public func + (left:SCNVector3, right:SCNVector3) -> SCNVector3 { | |
return SCNVector3(left.x + right.x, left.y + right.y, left.z + right.z) | |
} | |
public func += (inout left:SCNVector3, right:SCNVector3) { | |
left = left + right | |
} |
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
import SceneKit | |
class IcoSphere : Geometry { | |
// Initialize the data to the Icosahedron | |
var faceIndices:[Int32] = Icosahedron.faceIndices | |
var vertices:[SCNVector3] = Icosahedron.vertices | |
var wireframeIndices:[Int32] = Icosahedron.wireframeIndices | |
required init(subdivisions:Int) { | |
// Map string representations to indices (used to avoid duplicate vertices) |
NewerOlder