Skip to content

Instantly share code, notes, and snippets.

View bigmeech's full-sized avatar
🏀
Focusing

LE bigmeech

🏀
Focusing
  • United Kingdom
View GitHub Profile
@bigmeech
bigmeech / gen_pass.go
Last active March 21, 2017 20:24
gen pass
package main
import (
"fmt"
"math/rand"
"time"
"flag"
)
func getRandomStrings(str_len int) string {
@bigmeech
bigmeech / typeannot.elm
Created February 4, 2017 12:21
Sample elm snippets
import Html exposing (..)
-- union type for clipboard state
type ClipboardState = Active | Inactive | Other String
main =
text (toString report)
-- type anotation for reportState function
//in the route
route.post('/api/user', (req, res, next) => {
UserModel.insert(req.signUpData, (err, NewUser) => {
if(err) {
//i can do this
const NoUserError = new Error();
noUserError.code = 1111;
next(NoUserError)
//or this if i have mapped mongo's native duplicate_key constrain error in the mapper
'use strict';
const _ = require('lodash');
const errors = [
{
code: 404,
httpStatus: 404,
errorTemplate: '${resourceName} resource not found'
},
{
object UnifiedTypes extends App {
val set = new scala.collection.mutable.LinkedHashSet[Any]
set += "This is a string" // add a string
set += 732 // add a number
set += 'c' // add a character
set += true // add a boolean value
set += main _ // add the main function
val iter: Iterator[Any] = set.iterator
while (iter.hasNext) {
println(iter.next.toString())
function Harvester(options){
const socket = new net.Socket();
socket.connect({port:options.port, host:options.host}, ()=>{
socket.write(`+node|${options.node}\r\n`);
});
socket.on('connect', (socket) => console.log('Connected to Log Harvester!'));
socket.on('data', (data) => console.log('Message from Logio Server: ', data));
socket.on('error', (error) => console.log('Error from Logio Server: ', error.message));
socket.on('close', (error) => {
console.log(!error ? 'Client connection closed' : 'Client connection closed with Error');
@bigmeech
bigmeech / pktline-format.txt
Last active October 8, 2016 21:28
git packet line format
pkt-line = data-pkt / flush-pkt
data-pkt = pkt-len pkt-payload
pkt-len = 4*(HEXDIG)
pkt-payload = (pkt-len - 4)*(OCTET)
flush-pkt = "0000"
@bigmeech
bigmeech / git-http-proto.txt
Created October 8, 2016 15:38 — forked from schacon/git-http-proto.txt
Git HTTP transport protocol documentation
HTTP transfer protocols
=======================
Git supports two HTTP based transfer protocols. A "dumb" protocol
which requires only a standard HTTP server on the server end of the
connection, and a "smart" protocol which requires a Git aware CGI
(or server module). This document describes both protocols.
As a design feature smart clients can automatically upgrade "dumb"
protocol URLs to smart URLs. This permits all users to have the
@bigmeech
bigmeech / build_electron_properly.md
Created October 4, 2016 21:46
command to run electron build.

Electron's version.

export npm_config_target=1.2.3

The architecture of Electron, can be ia32 or x64.

export npm_config_arch=x64 export npm_config_target_arch=x64

Download headers for Electron.

export npm_config_disturl=https://atom.io/download/atom-shell

Tell node-pre-gyp that we are building for Electron.

export npm_config_runtime=electron

Tell node-pre-gyp to build module from source code.

I am trying to retrieve something from localstorage but would use that to decide what is served,
so until that happens execution cannot continue.
I feel I am doing something wrong as the getKey property of the LocalStorage retunrs a promise
import { Component, ViewChild } from '@angular/core';
import { ionicBootstrap, Platform, Nav, LocalStorage , Storage } from 'ionic-angular';
import { StatusBar, Splashscreen, Push } from 'ionic-native';