Skip to content

Instantly share code, notes, and snippets.

View megabites2013's full-sized avatar

SebastianX3024915 megabites2013

View GitHub Profile
@megabites2013
megabites2013 / server.js
Created July 10, 2021 13:09 — forked from joshj/server.js
Twitter OAuth with node-oauth for node.js+express
/*
Node.js, express, oauth example using Twitters API
Install Node.js:
curl -0 http://nodejs.org/dist/v0.6.11/node-v0.6.11.tar.gz
tar -zxf node-v0.6.11.tar.gz
cd node-v0.6.11
./configure
make
make install
package main
import (
"fmt"
"sort"
"time"
)
type User struct{
Name string
Email string
age int
func Reverse(s string) string {
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
return string(runes)
}
def getDayName(day)
dayName = ""
case day
when "Mon"
dayName = "Monday"
when "Tue"
dayName = "Tuesday"
when "Wed"
dayName = "Wednesday"
when "Thu"
fn main(){
println!("Hello from print.rs");
println!(
"{0} is from {1} and {0} likes to {2}",
"Nicholas",
"Stockholm",
"code"
);
println!(
"{name} likes to play {game}",
def pow (baseNum, powNum)
result = 1
powNum.times do |index|
result = result * baseNum
end
return result
end
puts pow(2,3)
using System;
class MainClass
{
static void Main (string[] args)
{
string secretWord = "Nicholas";
string guess = "";
int guesscount = 0;
while(guess != secretWord){
@megabites2013
megabites2013 / mockActivatedRoute.ts
Created March 4, 2020 21:24 — forked from benjamincharity/mockActivatedRoute.ts
Mock ActivatedRoute with params, data and snapshot.
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MdToolbarModule,
],
providers: [
{
provide: Router,
useClass: MockRouter,
},
@megabites2013
megabites2013 / PageableCollection.java
Created February 18, 2020 11:15 — forked from josericardo/PageableCollection.java
Helper to iterate over pageable sources. Should reduce memory usage when querying large tables via Spring Data.
======================================
Usage:
Fetcher<Source, MyEntity> f = new Fetcher<Source, MyEntity>(source) {
@Override
public List<MyEntity> fetch(Pageable pageRequest)
{
return source.findAll(pageRequest);
}
};
---------------------------------------------------------
-- Boilerplate mocking out what we already have today. --
-- Just scroll down to the bottom. --
---------------------------------------------------------
-- Cleanup
drop table if exists
import_log,
my_data_source,
meta_record,