Skip to content

Instantly share code, notes, and snippets.

View thosakwe's full-sized avatar
🎯
Focusing

Tobe Osakwe thosakwe

🎯
Focusing
View GitHub Profile
@thosakwe
thosakwe / searcher.asm
Created December 17, 2015 01:30
MASM32 Example - Using Assembly + WinAPI to browse the Internet
; We access the MangaEden API and request a list of the first 25 available manga. I used a buffer size of 5000, but feel free to modify it.
; I basically learned ASM today, just felt like posting this somewhere.
.386
.model flat, stdcall
option casemap:none
; Includes
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
@thosakwe
thosakwe / copy_directory.dart
Last active February 16, 2016 05:24
Recursively copy a directory in Dart by running CMD/Bash commands. Uses robocopy on Windows and cp on Mac/*NIX.
Future<bool> copy(Directory source, Directory destination) async {
String processName = Platform.isWindows ? "robocopy" : "cp";
List <String> args;
if (Platform.isWindows)
args = [source.absolute.path, destination.absolute.path, '/E', '/B'];
else
args = ['-r', source.absolute.path, destination.absolute.path];
Process cp = await Process.start(processName, args);
cp.stdout.listen(null); // For some reason, robocopy won't copy directories unless you listen to stdout
stderr.addStream(cp.stderr);
@thosakwe
thosakwe / polymer-element-webstorm-template
Last active February 25, 2016 01:22
A WebStorm file template for a Polymer v1.0 element.
<link rel="import" href="/path/to/polymer/polymer.html">
<dom-module id="#[[$Id$]]#">
<template></template>
<script>
Polymer({
is: '#[[$Id$]]#',
ready: function() {
//Do yo thang...
}
@thosakwe
thosakwe / app.js
Last active March 7, 2016 14:35
Angular Snip for Upwork
angular.module('nba_app', []).
.controller('NBACtrl', NBAController)
.service('Hello', HelloService);
@thosakwe
thosakwe / app.js
Last active March 18, 2016 14:31
TypeError: Cannot read property 'service' of undefined
import Feathers from 'feathers';
// ...
let app = Feathers();
app
.use(compress())
.options('*', cors())
.use(cors())
.use(BodyParser.json())
@thosakwe
thosakwe / CMakeLists.txt
Created April 21, 2016 03:56
FunctionalDict<TKey, TValue>
cmake_minimum_required(VERSION 3.5)
project(FunctionalDict)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
set(SOURCE_FILES main.cpp FunctionalDict.h)
add_executable(FunctionalDict ${SOURCE_FILES})
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
public class DiceProbability {
private static Random random = new Random();
private static int roll(int sides) {
int first = random.nextInt(sides) + 1;
@thosakwe
thosakwe / FooTranspiler.js
Last active May 13, 2016 00:57
Creating a....
var BaseListener = require('./FooListener').FooListener;
function FooTranspiler() {
BaseListener.call(this);
this.output = "";
}
FooTranspiler.prototype.enterAssignStmt = function(ctx) {
var target = ctx.ID().getText();
@thosakwe
thosakwe / build-client.sh
Last active June 24, 2016 18:41
MEAN Setup Script, feat. Mongo 3.2.7, Node 6, PM2, Nginx, also includes an FFMPEG install script
#!/usr/bin/env
# Run this in project root (/home/inet/app)
cd client && npm run build
@thosakwe
thosakwe / component.ts
Last active June 21, 2016 21:07
Angular2 - ngOnInit after Loading Data
import {Component, OnInit} from "@angular/core";
import FooService from "foo-service.ts";
@Component({
selector: "my-elem",
templateUrl: "my-elem.html",
providers: [FooService]
})
export default class MyElemCmp implements OnInit {
data = [];