Skip to content

Instantly share code, notes, and snippets.

View masaeedu's full-sized avatar

Asad Saeeduddin masaeedu

  • Montreal, QC, Canada
View GitHub Profile
{
"precedingString": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam",
data: {
"unimportant": "unimportant2",
"user": "Marcus",
"fullName": "Marcus Dwony",
"birthday": "14.05.1981",
"unimportant3": "unimportant4",
"unimportant5": "unimportant5
},
@masaeedu
masaeedu / gist:d89eb47ab7dcb3e269b8
Created May 17, 2015 05:41
Succintly doing string operations using LINQ and regex
var reg = new Regex(@"(\S+) \({([ \d]+)}\)");
var myStr = @"NULL ({ 8 9 36 37 }) John ({ 1 }) Loizou ({ 2 3 }) delves ({ 4 }) into ({ 5 })";
var lines = reg.Matches(myStr).Cast<Match>().Select(m =>
{
var prefix = m.Groups[1];
var nums = m.Groups[2].Value.Split().Where(s => !string.IsNullOrWhiteSpace(s));
return string.Format("{0} {1}_", prefix, string.Join(",", nums));
});
Console.WriteLine(string.Join(Environment.NewLine, lines));
@masaeedu
masaeedu / gist:1f6f2d3f1fdff190ee7a
Created May 18, 2015 02:24
Updated bouncing script
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext('2d');
//jupiter's gravity divided by 10 for testing purposes
g = 24.79/10;
canvas.width = window.innerWidth - 50;
canvas.height = window.innerHeight - 22.5;
bounciness = (1/2)
var spawnrate = 16;
var inertia = 0.00075;
@masaeedu
masaeedu / gist:fb1b5065b9df84004dd8
Created May 18, 2015 13:09
Concurrency problem with no parallelism
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private async void button1_Click(object sender, EventArgs e)
{
await Task.Run(() =>
<!DOCTYPE html>
<style>
/* Colors */
body {
background: url(http://i.imgur.com/aZty7Mq.png);
animation: mymove 4s linear infinite;
-webkit-animation: mymove 4s linear infinite;
-moz-animation: mymove 4s linear infinite;
}
@masaeedu
masaeedu / gist:618fc630652e0fd18557
Last active November 8, 2015 19:38
ME597 ROS particle filtering for localization
#include <ros/ros.h>
#include <nav_msgs/Odometry.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/Twist.h>
#include <gazebo_msgs/ModelStates.h>
#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>
#include <tf/transform_datatypes.h>
#include <Eigen/Dense>
componentWillMount() {
//fetch all dentist names
getAllDentists()
.then((results) => {
// Load reviews for all these dentists
for (dentist of results) {
getDentistReviews(dentist.id).then(response => {
this.setState(state => {
state[dentist.id] = response.reviews;
return state;
var staffDTOs = ctx.Set<Staff>().ToList().Select(s => new StaffDTO(s));
@masaeedu
masaeedu / shittyvariadics.cs
Last active November 30, 2020 13:53
Variadic experiments
using System;
using System.Linq.Expressions;
using VMware.Vim;
namespace AgentAutomation.VimExtensions
{
class Foo
{
static void Main()
{